//! WhirliGigEdit.debug.js
//

(function() {

////////////////////////////////////////////////////////////////////////////////
// jQueryJGigExtensions

jQuery.fn.popMenu = function jQueryJGigExtensions$popMenu(opt) {
    /// <param name="opt" type="Object">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    var gmu = new WhirliGig.Classes.GigMu();
    gmu.pdm = opt;
    ThemeYoshi.escapeOut = false;
    var btn = this;
    var tabBox = btn.createMenu('TabBox');
    var dict = opt['template'];
    var className = (opt['class'] || 'GigMu');
    tabBox.data('className', '.' + className);
    if (opt['host'] != null) {
        gmu.host = opt['host'];
        gmu.host.set_gmu(gmu);
    }
    var menus = opt['tabs'];
    var $enum1 = ss.IEnumerator.getEnumerator(menus);
    while ($enum1.moveNext()) {
        var n = $enum1.current;
        tabBox.addTab(gmu, n, dict[n]);
    }
    gmu.glass = Cluster.glass(function() {
        $(document).unbind('keydown.escGears');
        var el2 = tabBox.closest('.' + className);
        btn.removeMenu(tabBox);
        tabBox.remove();
        gmu.pdm = null;
        if (gmu.host != null) {
            gmu.host.set_gmu(null);
            gmu.host = null;
        }
        if (el2.length > 0) {
            el2.remove();
        }
        if (opt['Complete'] != null) {
            var cpt = opt['Complete'];
            cpt();
        }
    });
    $(document).unbind('keydown.escGears').bind('keydown.escGears', function(e) {
        if (e.which === 27) {
            ThemeYoshi.escapeOut = true;
            DomElement.cancelEvent(e);
            gmu.glass.trigger('mousedown');
        }
    });
    var el = $("<div class='MenuZee'/>").addClass(className).appendTo(document.body);
    gmu.top = el;
    tabBox.appendTo(el).show().resetTabs();
    tabBox.find('.Tab').first().trigger('mouseover');
    $("<div class='GigMuDragBar'/>").appendTo(el);
    el.draggable({ handle: '.GigMuDragBar' });
    return this;
}
jQuery.fn.createMenu = function jQueryJGigExtensions$createMenu(className) {
    /// <param name="className" type="String">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    var mu = $("<div class='GearBox'/>").addClass(className);
    $("<div class='Tabs'/>").appendTo(mu);
    $("<div class='Pads'/>").appendTo(mu);
    mu.data('popBtn', this);
    return mu;
}
jQuery.fn.removeMenu = function jQueryJGigExtensions$removeMenu(mu) {
    /// <param name="mu" type="jQueryObject">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    mu.empty();
    mu.removeData('className');
    mu.removeData('popBtn');
    return this;
}
jQuery.fn.addTab = function jQueryJGigExtensions$addTab(gmu, name, padDef) {
    /// <param name="gmu" type="WhirliGig.Classes.GigMu">
    /// </param>
    /// <param name="name" type="String">
    /// </param>
    /// <param name="padDef" type="Object">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    var pid = Formulas.get_newId();
    var tabFn = null;
    var plst = null;
    if ($.isFunction(padDef)) {
        tabFn = padDef;
    }
    else if ($.isArray(padDef)) {
        plst = padDef;
    }
    else {
        plst = new DList().add(padDef).end();
    }
    var tabBox = this;
    var tabs = tabBox.find('.Tabs');
    var pads = tabBox.find('.Pads');
    var align = (plst != null) ? plst[0].align || '' : '';
    var tab = $("<div class='Tab'/>");
    tab.appendTo(tabs).html(name.split(':')[0]).bind('mouseenter.Tab', function() {
        var el = tabBox.closest(tabBox.data('className'));
        tabs.children().removeClass('Hover');
        pads.children().hide();
        if (tabFn == null) {
            var thisPad = pads.find('#' + pid);
            el.css({ width: 400, height: 250 });
            thisPad.show();
            pads.css({ 'margin-top': (align === 'tab') ? tab.position().top : 0 });
        }
        el.css({ width: tabBox.outerWidth(), height: tabBox.outerHeight() });
        tab.addClass('Hover');
    });
    if (tabFn != null) {
        tab.swallowClick(tabFn);
    }
    else {
        ss.Debug.assert(plst != null, 'plst != null');
        var pad = $("<div class='Pad'/>").hide().attr('id', pid).appendTo(pads);
        var seter = null;
        var css = null;
        var tst = {};
        var prop = null;
        var $enum1 = ss.IEnumerator.getEnumerator(plst);
        while ($enum1.moveNext()) {
            var gmp = $enum1.current;
            var nnames = gmp.html.split('::');
            var value = (gmp.value != null) ? gmp.value : null;
            if (value == null) {
                value = (nnames.length > 1) ? nnames[1] : nnames[0];
            }
            gmp.value = value;
            seter = WhirliGig.Classes.JGigHelpers.prp(gmp, 'set', seter);
            css = WhirliGig.Classes.JGigHelpers.prp(gmp, 'css', css);
            prop = WhirliGig.Classes.JGigHelpers.prp(gmp, 'prop', prop);
            gmp.prop = prop;
            var pie = $("<div class='Pie'/>");
            pie.appendTo(pad).html(nnames[0]).click(Helpers.closureEv(function(e, s1, pi, dd) {
                var gmp2 = dd;
                if (gmu.host != null) {
                    gmu.pdp = gmp2;
                    gmu.pad = pad;
                    gmu.pie = pi;
                    gmu.pel = $(e.target);
                    gmu.host.fillGmu();
                    gmu.host.setSaved(false);
                }
                if (gmp2.prop != null) {
                    pad.find('.Pie.' + gmp2.prop).removeClass('Selected');
                    (pi).addClass('Selected');
                }
                if (s1 != null) {
                    s1(e);
                }
            }, seter, pie, gmp)).mousedown(function(e) {
                if (!$(e.target).is('select')) {
                    DomElement.cancelEvent(e);
                }
            }).mouseup(DomElement.cancelEvent).data('value', value);
            gmu.pdp = gmp;
            gmu.pad = pad;
            gmu.pie = pie;
            gmu.pel = null;
            if (gmu.host != null) {
                gmu.host.fillGmu();
            }
            if (prop != null) {
                pie.addClass(prop);
            }
            if (css != null) {
                pie.css(css);
            }
            if (gmp.brk) {
                $("<div class='Break'/>").appendTo(pad);
            }
            if (gmp.hr) {
                $('<hr/>').appendTo(pad);
            }
            if (gmu.host != null) {
                tst['item'] = gmp;
                tst['value'] = value;
                gmu.host.markItem(pie, tst);
            }
            if (gmp.build != null) {
                gmp.build(gmu);
            }
        }
    }
    return tabBox;
}
jQuery.fn.resetTabs = function jQueryJGigExtensions$resetTabs() {
    /// <returns type="jQueryObject"></returns>
    var ths = this;
    var tabs = ths.find('.Tabs');
    var pads = ths.find('.Pads');
    var el = ths.closest(ths.data('className'));
    tabs.children().removeClass('Hover');
    pads.children().hide();
    el.position({ my: 'left top', at: 'left top', of: ths.data('popBtn'), offset: '-5 -5' });
    el.css({ width: ths.outerWidth(), height: ths.outerHeight() });
    var p = el.offset();
    var w = 400;
    var h = 300;
    if (p.left - document.body.scrollLeft + w > window.self.innerWidth) {
        el.css({ left: window.self.innerWidth + document.body.scrollLeft - w });
    }
    if (p.top - document.body.scrollHeight + h > window.self.innerHeight) {
        el.css({ top: window.self.innerHeight + document.body.scrollHeight - h });
    }
    return ths;
}
jQuery.fn.positionAt = function jQueryJGigExtensions$positionAt(node) {
    /// <param name="node" type="jQueryObject">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    var p = node.offset();
    var x = node.position();
    this.css({ top: p.top, left: x.left });
    Inform.debug('o.top {0}, o.left {1}, p.top {2}, p.left {3}', p.top, p.left, x.top, x.left);
    return this;
}


Type.registerNamespace('WhirliGig.Classes');

////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.IFocusable

WhirliGig.Classes.IFocusable = function() { 
};
WhirliGig.Classes.IFocusable.prototype = {
    get_gmu : null,
    set_gmu : null,
    markItem : null,
    fillGmu : null,
    setSaved : null
}
WhirliGig.Classes.IFocusable.registerInterface('WhirliGig.Classes.IFocusable');


////////////////////////////////////////////////////////////////////////////////
// ChompWindow

ChompWindow = function ChompWindow() {
    ChompWindow.initializeBase(this);
    this.element = $("<iframe class='ChompIFrame'/>").css({ width: '100%', height: 450, border: 'none', margin: 0, padding: 0, 'border-top': '1px solid #AAA', 'border-bottom': '1px solid #AAA' });
}
ChompWindow.prototype = {
    
    src: function ChompWindow$src(url) {
        /// <param name="url" type="String">
        /// </param>
        /// <returns type="ChompWindow"></returns>
        this.element.attr('src', url);
        return this;
    }
}


////////////////////////////////////////////////////////////////////////////////
// EditCss

EditCss = function EditCss() {
    /// <field name="_full$4" type="Boolean">
    /// </field>
    /// <field name="_src$4" type="Object">
    /// </field>
    EditCss.initializeBase(this);
}
EditCss.prototype = {
    _full$4: false,
    _src$4: null,
    
    editDAw: function EditCss$editDAw(awp, cssD) {
        /// <param name="awp" type="Await">
        /// </param>
        /// <param name="cssD" type="Object">
        /// </param>
        this._src$4 = cssD;
        cssD = cssD.css || cssD;
        var css = { width: '340px', height: '380px' };
        var cssTxt = Rx.prettyJson(cssD || {}, '\t').replace(/^{[\r\n]*|[\r\n]*}$|\t/g, '');
        this.textAreaAw(awp, { Msg: 'Edit raw css', Value: cssTxt, Css: css, Attr: { wrap: 'off' }, Customize: ss.Delegate.create(this, this._customStuff$4), Verify: ss.Delegate.create(this, function(result) {
            try {
                this._rePkg$4(result);
                this._destroy$4();
                return true;
            }
            catch (ex) {
                alert(String.format('Invalid css : {0}', ex));
                return false;
            }
        }), Complete: ss.Delegate.create(this, function(result) {
            return this._rePkg$4(result);
        }), Finally: ss.Delegate.create(this, this._destroy$4) });
        this._fullEv$4(null);
    },
    
    _rePkg$4: function EditCss$_rePkg$4(txt) {
        /// <param name="txt" type="String">
        /// </param>
        /// <returns type="Object"></returns>
        if (!this._full$4) {
            txt = txt.replace(/([^,])\s*?\n/g, '$1,\n');
        }
        txt = txt.replace(/[,\s]+?\n/g, ',\n');
        txt = txt.replace(/[,\s]+$/g, '');
        if (this._full$4) {
            return JSON.parse(txt);
        }
        return JSON.parse('{' + txt + '}');
    },
    
    _customStuff$4: function EditCss$_customStuff$4() {
        Cluster.hiderElement.unbind('mousedown.swallowed').bind('mousedown.swallowed', ss.Delegate.create(this, function() {
            this.get_cancelBtn().click();
        }));
        $(document.body).bind('keydown.EditCssExamples', ss.Delegate.create(this, function(e) {
            if (e.which === 112) {
                this._examplesEv$4(e);
            }
        }));
        $('<span/>').appendTo(this.element).css({ position: 'absolute', top: 15, right: 15, cursor: 'pointer', color: 'blue' }).html('[help]').click(ss.Delegate.create(this, this._examplesEv$4));
    },
    
    _fullEv$4: function EditCss$_fullEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this._full$4 = true;
        $('.Content', this.element).val(Rx.prettyJson(this._src$4 || {}));
    },
    
    _examplesEv$4: function EditCss$_examplesEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        var box = $("<div id='EditCssExamples' class='AboveHider Corners20'/>").insertAfter(this.element).css({ position: 'absolute', width: 500, height: 600, border: '5px solid green', background: '#FFC' }).bind('keydown', ss.Delegate.create(this, function(e3) {
            if (e3.which === 27) {
                this._closeHelpEv$4(e3);
            }
        }));
        box.position({ my: 'top center', at: 'top center', of: this.element });
        $('<span/>').appendTo(box).css({ position: 'absolute', top: 12, right: 10, cursor: 'pointer', color: 'blue' }).html('close').click(ss.Delegate.create(this, this._closeHelpEv$4));
        $("<textarea id='EditCssHelpTxt'/>").appendTo(box).css({ position: 'absolute', top: 34, right: 8, bottom: 10, left: 8, color: 'black', border: 'none', padding: '3px 5px' });
        Keys.filterAll(box);
        new Await().loadText('EditCssHelp', Uri.scripts('Data/EditCssHelp.txt')).handleDl(Exceptions.blobLoadError, Await.abortAw).addDx(function() {
            $('#EditCssHelpTxt').val(Await.files['EditCssHelp']).focus();
        }).commit();
    },
    
    _closeHelpEv$4: function EditCss$_closeHelpEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (e != null) {
            DomElement.cancelEvent(e);
        }
        $('#EditCssExamples').remove();
        $('.Content', this.element).focus();
    },
    
    _destroy$4: function EditCss$_destroy$4() {
        this._closeHelpEv$4(null);
        $(document.body).unbind('keydown.EditCssExamples');
    }
}


////////////////////////////////////////////////////////////////////////////////
// EditRawGigs

EditRawGigs = function EditRawGigs() {
    /// <field name="_slides$3" type="GigShowEdit">
    /// </field>
    /// <field name="_outer$3" type="jQueryObject">
    /// </field>
    /// <field name="_textarea$3" type="jQueryObject">
    /// </field>
    EditRawGigs.initializeBase(this);
    this._outer$3 = $("<div id='EditRawGigs' class='AboveHider'/>").appendTo(document.body);
    this._textarea$3 = $("<textarea wrap='off' style='font-family:courier new;font-size:8pt'/>").appendTo(this._outer$3);
    this._outer$3.bind('keydown.esc', ss.Delegate.create(this, function(e2) {
        Keys.escKey(e2, ss.Delegate.create(this, this._close$3));
    }));
    this._outer$3.position({ my: 'top center', at: 'top center', of: window.self });
    Keys.filterAll(this._outer$3);
    DomElement.focusElementAw(Await.get_asyncAw(), this._textarea$3);
}
EditRawGigs.ev = function EditRawGigs$ev(e, gse) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    /// <param name="gse" type="GigShowEdit">
    /// </param>
    DomElement.cancelEvent(e);
    var erg = new EditRawGigs();
    erg._slides$3 = gse;
    var sds = gse.slides;
    var cssTxt = Rx.prettyJson(sds, '  ');
    erg._textarea$3.val(cssTxt);
    erg._textarea$3.bind('keydown.shirtret', function(e2) {
        Keys.shiftRetKey(e2, ss.Delegate.create(erg, erg._saveGigsEv$3));
    });
}
EditRawGigs.pasteBuffer = function EditRawGigs$pasteBuffer(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    DomElement.cancelEvent(e);
    var erg = new EditRawGigs();
    var txt = Rx.prettyJson(Nsb.Storage.getLocal('CopyBuffer'), '  ');
    erg._textarea$3.val(txt);
    erg._textarea$3.bind('keydown.shiftret', function(e2) {
        Keys.shiftRetKey(e2, ss.Delegate.create(erg, erg._savePasteEv$3));
    });
}
EditRawGigs.prototype = {
    _slides$3: null,
    _outer$3: null,
    _textarea$3: null,
    
    _saveGigsEv$3: function EditRawGigs$_saveGigsEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var txt = $('#EditRawGigs textarea').val().trim();
        try {
            var slides = JSON.parse(txt);
            this._slides$3.slides = slides;
            new Await().addAw(ss.Delegate.create(this._slides$3, this._slides$3.restoreSlideAw), this._slides$3.slide).addAw(ss.Delegate.create(this._slides$3, this._slides$3.saveAllAw)).commit();
            this._close$3(e);
        }
        catch (ex) {
            alert('Error parsing json\n\n' + ex);
        }
    },
    
    _savePasteEv$3: function EditRawGigs$_savePasteEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var txt = $('#EditRawGigs textarea').val().trim();
        try {
            var tst = JSON.parse(txt);
            Nsb.Storage.setLocal('CopyBuffer', tst);
            this._close$3(e);
        }
        catch (ex) {
            alert('Error parsing json\n\n' + ex);
        }
    },
    
    _close$3: function EditRawGigs$_close$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        $('#EditRawGigs').remove();
    }
}


////////////////////////////////////////////////////////////////////////////////
// GigEdit

GigEdit = function GigEdit(show) {
    /// <param name="show" type="GigShowEdit">
    /// </param>
    /// <field name="yourText" type="String" static="true">
    /// </field>
    /// <field name="embeddedCodeType" type="String" static="true">
    /// </field>
    /// <field name="coverBloatClass" type="String" static="true">
    /// </field>
    /// <field name="_maskOnClass$4" type="String" static="true">
    /// </field>
    /// <field name="_dotMaskOnClass$4" type="String" static="true">
    /// </field>
    /// <field name="_gigTypes$4" type="Object" static="true">
    /// </field>
    /// <field name="_gmu$4" type="WhirliGig.Classes.GigMu" static="true">
    /// </field>
    /// <field name="editor" type="GigShowEdit">
    /// </field>
    /// <field name="_snapToNone$4" type="jQueryObject">
    /// </field>
    /// <field name="cover" type="jQueryObject">
    /// </field>
    /// <field name="coverInner" type="jQueryObject">
    /// </field>
    /// <field name="queSave" type="Boolean">
    /// </field>
    /// <field name="theGear" type="jQueryObject">
    /// </field>
    /// <field name="_savedGig$4" type="WhirliGig.Classes.GigData">
    /// </field>
    /// <field name="_snapToEl$4" type="jQueryObject">
    /// </field>
    /// <field name="_snapToH$4" type="Number">
    /// </field>
    /// <field name="_snapToPos$4" type="Array" elementType="Number">
    /// </field>
    /// <field name="_snapToW$4" type="Number">
    /// </field>
    /// <field name="_xc$4" type="Number" integer="true">
    /// </field>
    /// <field name="_yc$4" type="Number" integer="true">
    /// </field>
    this._snapToNone$4 = jQuery();
    GigEdit.initializeBase(this);
    TestInstance.addInstance(this);
    this.editor = show;
    this.element.data('gigEdit', this);
}
GigEdit.gigGigByEl = function GigEdit$gigGigByEl(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    /// <returns type="Gig"></returns>
    try {
        return el.data(Gig.gigClassName);
    }
    catch ($e1) {
        return null;
    }
}
GigEdit._propKeys$4 = function GigEdit$_propKeys$4(el, min, max) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    /// <param name="min" type="Number" integer="true">
    /// </param>
    /// <param name="max" type="Number" integer="true">
    /// </param>
    /// <returns type="Number" integer="true"></returns>
    var i = GigEdit._numberKeys$4(el.val());
    i = Math.max(Math.min((isNaN(i)) ? min : i, max), min);
    el.val((i === min) ? '' : i.toString());
    return i;
}
GigEdit._numberKeys$4 = function GigEdit$_numberKeys$4(txt) {
    /// <param name="txt" type="String">
    /// </param>
    /// <returns type="Number" integer="true"></returns>
    txt = txt.trim();
    var t2 = '';
    for (var i = 0; i < txt.length; i++) {
        var d = ')!@#$%^&*('.indexOf(txt.charAt(i));
        t2 += (d >= 0) ? d.toString() : txt.charAt(i).toString();
    }
    return parseInt(t2);
}
GigEdit.textAreaExpander = function GigEdit$textAreaExpander(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    el.bind('keydown.editev paste.editev cut.editev', function() {
        window.setTimeout(function() {
            GigEdit.resizeEl(el);
        }, 1);
    });
    GigEdit.resizeEl(el);
}
GigEdit.resizeEl = function GigEdit$resizeEl(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    var ht = el.height(0)[0].scrollHeight;
    el.height(ht);
}
GigEdit.replaceText = function GigEdit$replaceText(html, content, selector) {
    /// <param name="html" type="String">
    /// </param>
    /// <param name="content" type="String">
    /// </param>
    /// <param name="selector" type="String">
    /// </param>
    /// <returns type="String"></returns>
    selector = selector || Gig.dotGigContentClassName;
    var el = $(html).appendTo(document.body);
    el.find(selector).setContent(content);
    var ot = DomElement.outerHtml(el);
    el.remove();
    return ot;
}
GigEdit.domify = function GigEdit$domify(html) {
    /// <param name="html" type="String">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    return $(html).appendTo(document.body);
}
GigEdit.domifyContent = function GigEdit$domifyContent(html, selector) {
    /// <param name="html" type="String">
    /// </param>
    /// <param name="selector" type="String">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    var el = GigEdit.domify(html);
    var cel = $(selector, el).appendTo(document.body);
    el.remove();
    return cel;
}
GigEdit.domContent = function GigEdit$domContent(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    /// <returns type="jQueryObject"></returns>
    return el.find(Gig.dotGigContentClassName);
}
GigEdit.prototype = {
    editor: null,
    cover: null,
    coverInner: null,
    queSave: false,
    theGear: null,
    _savedGig$4: null,
    _snapToEl$4: null,
    _snapToH$4: 0,
    _snapToPos$4: null,
    _snapToW$4: 0,
    _xc$4: 0,
    _yc$4: 0,
    
    get_myGd: function GigEdit$get_myGd() {
        /// <value type="WhirliGig.Classes.GigData"></value>
        return this.editor.gigById(this.id);
    },
    
    get_myCss: function GigEdit$get_myCss() {
        /// <value type="Object"></value>
        ss.Debug.assert(this.get_myGd().css != null);
        return this.get_myGd().css;
    },
    
    markItem: function GigEdit$markItem(pie, tst) {
        /// <param name="pie" type="jQueryObject">
        /// </param>
        /// <param name="tst" type="Object">
        /// </param>
        var d = tst['item'];
        tst['prop'] = WhirliGig.Classes.JGigHelpers.prp(d, 'prop', tst['prop']);
        var prop = tst['prop'];
        var tBool = d['bool'];
        var tNotBool = d['!bool'];
        if (tBool != null) {
            if (this.get_myGd()[tBool]) {
                pie.addClass('Selected');
            }
        }
        else if (tNotBool != null) {
            if (!this.get_myGd()[tNotBool]) {
                pie.addClass('Selected');
            }
        }
        else if (prop != null) {
            var gp = this.get_myCss()[prop];
            if (!String.isNullOrEmpty(gp)) {
                gp = gp.replace(Rx.cssFilter, '');
                if (gp === tst['value']) {
                    pie.addClass('Selected');
                }
            }
        }
    },
    
    get_gmu: function GigEdit$get_gmu() {
        /// <value type="WhirliGig.Classes.GigMu"></value>
        return GigEdit._gmu$4;
    },
    set_gmu: function GigEdit$set_gmu(value) {
        /// <value type="WhirliGig.Classes.GigMu"></value>
        GigEdit._gmu$4 = value;
        return value;
    },
    
    fillGmu: function GigEdit$fillGmu() {
        GigEdit._gmu$4.css = this.get_myCss();
    },
    
    setSaved: function GigEdit$setSaved(ic) {
        /// <param name="ic" type="Boolean">
        /// </param>
        this.queSave = !ic;
    },
    
    get_myPgBgColor: function GigEdit$get_myPgBgColor() {
        /// <value type="String"></value>
        var pg = this.editor.get_currentSlide();
        return ((pg && pg.css && pg.css['background-color']) || 'rgba(0,0,0,0)');
    },
    
    get_myPgInvBgColor: function GigEdit$get_myPgInvBgColor() {
        /// <value type="String"></value>
        var c = Css.getColor(this.get_myPgBgColor());
        return (c.red < 128) ? 'rgba(255,255,255,1)' : 'rgba(0,0,0,1)';
    },
    
    addCover: function GigEdit$addCover() {
        this.coverInner = $("<div class='CoverInner'/>").appendTo(this.element);
        this.cover = $("<div class='Cover'/>").appendTo(this.element).bind('mouseenter.Gig', ss.Delegate.create(this, this._maskOnEv$4)).bind('mouseleave.Gig', ss.Delegate.create(this, this._maskOffEv$4)).bind('click.Gig', ss.Delegate.create(this, this.mouseGroupEv)).dblclick(ss.Delegate.create(this, this._doubleClickEv$4)).bind('contextmenu', ss.Delegate.create(this, this.rightClickEv));
        this.theGear = $("<div class='TheGear'/>").appendTo(this.cover).hide().html("<img src='" + Uri.img('Common/gear16.gif') + "'/>").bind('click.TheGear', ss.Delegate.create(this, this.gearsOnEv));
        $("<div class='Sizer'/>").appendTo(this.cover).append($("<img src='" + Uri.img('Common/dragger.png') + "' style='width:100%;height:100%'/>")).mousedown(ss.Delegate.create(this, this._sizeMeOnEv$4)).hide();
        $("<div class='Tilter'/>").appendTo(this.cover).append($("<img src='" + Uri.img('Common/dragger.png') + "' style='width:100%;height:100%'/>")).mousedown(ss.Delegate.create(this, this._tiltMeOnEv$4)).hide();
    },
    
    _menuInstance$4: function GigEdit$_menuInstance$4() {
        /// <returns type="Object"></returns>
        var mu = new DDict().add('colors:both', new DList().add({ html: this._colorPickerTable$4('text', 'color'), set: ss.Delegate.create(this, this.pickFgColorEv) }).add({ html: this._colorPickerTable$4('background', 'background-color'), set: ss.Delegate.create(this, this._pickBgColorEv$4) }).end()).add('color:bg', new DList().add({ html: this._colorPickerTable$4('background', 'background-color'), set: ss.Delegate.create(this, this._pickBgColorEv$4) }).end()).add('border', new DList().add({ html: '1', set: ss.Delegate.create(this, this._borderSzEv$4), prop: 'border-width' }).add({ html: '2' }).add({ html: '3' }).add({ html: '4' }).add({ html: '5' }).add({ html: '6' }).add({ html: '7' }).add({ html: '8' }).add({ html: '9' }).add({ html: '10' }).add({ html: '11', brk: true }).add({ html: this._roundingPie$4(), set: ss.Delegate.create(this, this._roundingEv$4), build: ss.Delegate.create(this, this._borderBld$4), prop: false }).add({ html: this._colorPickerTable$4('border color', 'border-color'), set: ss.Delegate.create(this, this._pickBdrColorEv$4), css: { display: 'inline-block', 'vertical-align': 'top' }, prop: false }).end()).add('font', new DList().add({ html: 'bold', set: ss.Delegate.create(this, this._fontStlEv$4), prop: 'font-weight' }).add({ html: 'no-bold', value: 'normal' }).add({ html: 'italic', prop: 'font-style' }).add({ html: 'no-italic', value: 'normal', hr: true }).add({ html: 'left', set: ss.Delegate.create(this, this._fontAlignEv$4), prop: 'text-align' }).add({ html: 'center' }).add({ html: 'right', hr: true }).add({ html: '7', set: ss.Delegate.create(this, this._fontSzEv$4), prop: 'font-size' }).add({ html: '8' }).add({ html: '9' }).add({ html: '10' }).add({ html: '11' }).add({ html: '12' }).add({ html: '14' }).add({ html: '16' }).add({ html: '18', brk: true }).add({ html: '20' }).add({ html: '22' }).add({ html: '24' }).add({ html: '28' }).add({ html: '32' }).add({ html: '36' }).add({ html: '40' }).add({ html: '48' }).add({ html: '56', brk: true }).add({ html: '72' }).add({ html: '80' }).add({ html: '88' }).add({ html: '96' }).add({ html: '102' }).add({ html: '110' }).add({ html: '118', hr: true }).add({ html: 'Arial', set: ss.Delegate.create(this, this._fontFamilyEv$4), prop: 'font-family' }).add({ html: 'Arial Black' }).add({ html: 'Comic Sans Ms' }).add({ html: 'Courier New', brk: true }).add({ html: 'Calibri' }).add({ html: 'Cambria' }).add({ html: 'Georgia' }).add({ html: 'Tahoma', brk: true }).add({ html: 'Times New Roman' }).add({ html: 'Verdana' }).end()).add('layer', new DList().add({ html: '<u>f</u>ront', set: ss.Delegate.create(this.editor, this.editor.toFrontEv) }).add({ html: '<u>b</u>ack', set: ss.Delegate.create(this.editor, this.editor.toBackEv) }).add({ html: '<u>h</u>igher', set: ss.Delegate.create(this.editor, this.editor.toHigherEv) }).add({ html: '<u>l</u>ower', set: ss.Delegate.create(this.editor, this.editor.toLowerEv), brk: true }).add({ html: 'float', set: ss.Delegate.create(this.editor, this.editor.floatEv), bool: 'floated', prop: 'floated' }).add({ html: 'unfloat', set: ss.Delegate.create(this.editor, this.editor.unFloatEv), '!bool': 'floated', brk: true }).add({ html: 'auto-stack', set: ss.Delegate.create(this.editor, this.editor.embeddedEv), bool: 'embedded', prop: 'embedded' }).add({ html: 'free-form', set: ss.Delegate.create(this.editor, this.editor.unEmbeddedEv), '!bool': 'embedded', brk: true }).add({ html: 'auto-size', set: ss.Delegate.create(this.editor, this.editor.autosizeEv), bool: 'autosize', prop: 'autosize' }).add({ html: 'fixed-size', set: ss.Delegate.create(this.editor, this.editor.unAutosizeEv), '!bool': 'autosize', hr: true }).add({ html: 'bullet', set: ss.Delegate.create(this.editor, this.editor.formatUlEv) }).add({ html: 'numbered', set: ss.Delegate.create(this.editor, this.editor.formatOlEv) }).add({ html: 'plain', set: ss.Delegate.create(this.editor, this.editor.formatPlainEv), hr: true }).end()).add('copy', ss.Delegate.create(this.editor, this.editor.copyEv)).add('groupify:<u>g</u>roupify', ss.Delegate.create(this, this.groupifyEv)).add('ungroup:un<u>g</u>roup', ss.Delegate.create(this, this.ungroupEv)).add('zero', ss.Delegate.create(this, this.zeroEv)).add('link', ss.Delegate.create(this, this.linkEv)).add('remove', ss.Delegate.create(this.editor, this.editor.deleteEv)).add('cancel', ss.Delegate.create(this, this._gearsCancelEv$4)).end();
        return mu;
    },
    
    maskOff: function GigEdit$maskOff() {
        this._maskOffEv$4(null);
    },
    
    maskOn: function GigEdit$maskOn() {
        this._maskOnEv$4(null);
    },
    
    _maskOnEv$4: function GigEdit$_maskOnEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (ThemeYoshi.supressCurateEvents) {
            return;
        }
        $('.TheGear, .Sizer, .Tilter', this.element.children('.Cover')).addClass('MaskOn').show();
        this.editor.set_focGigEdit(this);
        if (!String.isNullOrEmpty(this.get_myGd().groupId)) {
            var gg = this.editor.collectGroup(e, this.get_myGd().groupId);
            var $enum1 = ss.IEnumerator.getEnumerator(gg);
            while ($enum1.moveNext()) {
                var dd = $enum1.current;
                $('.Cover', dd.el).copyRadius(dd.gd.css, 2).addClass('MaskOn').show();
                $('.CoverInner', dd.el).copyRadius(dd.gd.css, 2).addClass('MaskOn').show();
            }
        }
        else {
            this.element.children('.Cover').copyRadius(this.get_myCss(), 2).show();
            this.element.children('.CoverInner').copyRadius(this.get_myCss(), 2).addClass('MaskOn').show();
        }
        DomElement.cancelEvent(e);
    },
    
    _maskOffEv$4: function GigEdit$_maskOffEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        $('.Cover' + GigEdit._dotMaskOnClass$4, GigShow.pageSelectToEl).removeClass('MaskOn');
        $(GigEdit._dotMaskOnClass$4, GigShow.pageSelectToEl).removeClass('MaskOn').hide();
        DomElement.cancelEvent(e);
    },
    
    rightClickEv: function GigEdit$rightClickEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (!e.shiftKey) {
            this.gearsOnEv(e);
        }
    },
    
    gearsOnEv: function GigEdit$gearsOnEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        ThemeBase.shiftKey = e.shiftKey;
        this.editor.clearPaint();
        var gd = this.get_myGd();
        ThemeYoshi.supressCurateEvents = true;
        ThemeYoshi.escapeOut = false;
        this.queSave = false;
        this._savedGig$4 = $.extend(true, {}, gd);
        var tabs = $.extend([], (GigEdit._gigTypes$4[this.get_myGd().type])['menus']);
        if (!String.isNullOrEmpty(gd.groupId)) {
            for (var i = 0; i < tabs.length; i++) {
                if (tabs[i] === 'groupify:<u>g</u>roupify') {
                    tabs[i] = 'ungroup:un<u>g</u>roup';
                }
            }
        }
        this.theGear.popMenu({ tabs: tabs, template: this._menuInstance$4(), host: this, Complete: ss.Delegate.create(this, function() {
            ThemeYoshi.supressCurateEvents = false;
            if (ThemeYoshi.escapeOut) {
                this.editor.get_currentSlide().gigs[this.id] = this._savedGig$4;
                this.editor.reSlideAndSave(e);
            }
            else if (this.queSave) {
                this.editor.reSlideAndSave(e);
            }
        }) });
        DomElement.cancelEvent(e);
    },
    
    _gearsCancelEv$4: function GigEdit$_gearsCancelEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        ThemeYoshi.escapeOut = true;
        $('.VirtualGlass').trigger('mousedown');
        DomElement.cancelEvent(e);
    },
    
    _sizeMeOnEv$4: function GigEdit$_sizeMeOnEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.element.draggable('disable');
        $(document).bind('mousemove.Gig', ss.Delegate.create(this, this._sizeMoveEv$4));
        $(document).bind('mouseup.Gig', ss.Delegate.create(this, this._sizeMeOffEv$4));
        this.cover.unbind('mouseenter.Gig');
        this.cover.unbind('mouseleave.Gig');
        this.cover.addClass('RubberBand');
        this._maskOnEv$4(e);
        DomElement.cancelEvent(e);
        var el = $(e.target).closest('div.Gig');
        if (el.length > 0) {
            this._snapToEl$4 = el;
            this._snapToW$4 = el.outerWidth();
            this._snapToH$4 = el.outerHeight();
            var tilt = Math.abs(el[0].tilt);
            if (tilt > 0) {
                var ww = this._snapToW$4;
                var hh = this._snapToH$4;
                var tt = el.snapToTilt(tilt);
                this._snapToW$4 = el.snapToTiltW(tt, ww, hh);
                this._snapToH$4 = el.snapToTiltH(tt, ww, hh);
            }
            el.addClass('GigMe');
            el.snapCollect('div.Gig:not(.GigMe), ' + GigShow.pageSelectTo);
            el.removeClass('GigMe');
        }
    },
    
    _sizeMeOffEv$4: function GigEdit$_sizeMeOffEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        $(document).unbind('mousemove.Gig');
        $(document).unbind('mouseup.Gig');
        this.cover.bind('mouseenter.Gig', ss.Delegate.create(this, this._maskOnEv$4));
        this.cover.bind('mouseleave.Gig', ss.Delegate.create(this, this._maskOffEv$4));
        this.cover.removeClass('RubberBand');
        this._maskOffEv$4(e);
        this.element.draggable('enable');
        var wd = this.element.width();
        var ht = this.element.height();
        if (this._snapToEl$4.length > 0) {
            var xo = parseInt(this.element.css('padding-left')) + parseInt(this.element.css('padding-right'));
            var yo = parseInt(this.element.css('padding-top')) + parseInt(this.element.css('padding-bottom'));
            var bw = parseInt(this.element.css('border-right-width')) * 2;
            var bh = parseInt(this.element.css('border-bottom-width')) * 2;
            wd = Math.max(this._snapToPos$4[0] - this.element.offset().left - xo - bw, 20);
            ht = Math.max(this._snapToPos$4[1] - this.element.offset().top - yo - bh, 20);
            this._snapToEl$4.snapDump();
            this._snapToEl$4 = this._snapToNone$4;
            this.element.width(wd);
            if (this.get_myGd().hasHeight) {
                this.element.height(ht);
            }
        }
        var gd = this.get_myGd();
        gd.dim = new WhirliGig.Classes.Dimension();
        gd.dim.width = wd;
        gd.dim.height = ht;
        GigShow.mapCss(gd, this.element, gd.css);
        this.editor.reSlideAndSave(e);
    },
    
    _sizeMoveEv$4: function GigEdit$_sizeMoveEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var xo = parseInt(this.element.css('padding-left')) + parseInt(this.element.css('padding-right'));
        var yo = parseInt(this.element.css('padding-top')) + parseInt(this.element.css('padding-bottom'));
        var wd = Math.max(e.pageX - this.element.offset().left - xo, 20);
        var ht = Math.max(e.pageY - this.element.offset().top - yo, 20);
        var bw = parseInt(this.element.css('border-right-width')) * 2;
        var bh = parseInt(this.element.css('border-bottom-width')) * 2;
        this.element.width(wd);
        if (this.get_myGd().hasHeight) {
            this.element.height(ht);
        }
        DomElement.cancelEvent(e);
        if (this._snapToEl$4.length > 0) {
            this._snapToPos$4 = this._snapToEl$4.snapDim(this.element.offset().left + wd + xo + bw, this.element.offset().top + ht + yo + bh, Math.round(this.element.outerWidth() / 2), Math.round(this.element.outerHeight() / 2));
        }
    },
    
    scoopPosition: function GigEdit$scoopPosition() {
        var tilt = this.get_myGd().tilt;
        this.element.rotate({ angle: 0 });
        var gd = this.get_myGd();
        gd.pos = this.element.position();
        this.element.rotate({ angle: tilt });
    },
    
    _tiltMeOnEv$4: function GigEdit$_tiltMeOnEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.element.draggable('disable');
        $(document).bind('mousemove.Gig', ss.Delegate.create(this, this._tiltMoveEv$4));
        $(document).bind('mouseup.Gig', ss.Delegate.create(this, this._tiltMeOffEv$4));
        this.cover.unbind('mouseenter.Gig');
        this.cover.unbind('mouseleave.Gig');
        this.cover.addClass('RubberBand');
        this._maskOnEv$4(e);
        this.element.rotate({ angle: 0 });
        this._xc$4 = this.element.offset().left + (this.element.width() / 2);
        this._yc$4 = this.element.offset().top + (this.element.height() / 2);
        DomElement.cancelEvent(e);
    },
    
    _tiltMeOffEv$4: function GigEdit$_tiltMeOffEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        $(document).unbind('mousemove.Gig');
        $(document).unbind('mouseup.Gig');
        this.cover.bind('mouseenter.Gig', ss.Delegate.create(this, this._maskOnEv$4));
        this.cover.bind('mouseleave.Gig', ss.Delegate.create(this, this._maskOffEv$4));
        this.cover.removeClass('RubberBand');
        this._maskOffEv$4(e);
        this.element.draggable('enable');
        this.get_myGd().tilt = this.element.data('gigTilt');
        Inform.debug('TiltMeOff tilt = {0}', this.get_myGd().tilt);
        this.editor.cancelAndSaveAll(e);
    },
    
    _tiltMoveEv$4: function GigEdit$_tiltMoveEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var deg;
        var x = e.pageX - this._xc$4;
        var y = 0 - (e.pageY - this._yc$4);
        deg = Math.atan(x / y) * 180 / Math.PI;
        if (y < 0) {
            deg += 180;
        }
        else if (x < 0) {
            deg += 360;
        }
        this.addTilt(deg);
        DomElement.cancelEvent(e);
    },
    
    zeroEv: function GigEdit$zeroEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.addTilt(0);
        this.get_myGd().tilt = 0;
        this.editor.cancelAndSaveAll(e);
    },
    
    linkEv: function GigEdit$linkEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        Cluster.glassOff();
        new Await().addAw(ss.Delegate.create(new Ask(), new Ask().textAw), { Msg: 'Enter link address', Value: GigShowEdit.linkHref(this.get_myGd()) }).addAw(DomElement.requireResultAw, DomElement.notFail).addDx(ss.Delegate.create(this, function(aw) {
            GigShowEdit.linkifyContent(this.get_myGd(), aw.get_result());
            this.editor.reSlideAndSave(e);
        })).commit();
    },
    
    groupifyEv: function GigEdit$groupifyEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        Cluster.glassOff();
        this.maskOff();
        this.editor.groupify(this.get_myGd(), true);
        this.editor.cancelAndSaveAll(e);
        this.maskOn();
    },
    
    ungroupEv: function GigEdit$ungroupEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        Cluster.glassOff();
        this.maskOff();
        this.editor.groupify(this.get_myGd(), false);
        this.editor.cancelAndSaveAll(e);
    },
    
    mouseGroupEv: function GigEdit$mouseGroupEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (e.shiftKey) {
            this.groupAddEv(e);
        }
        else if (e.altKey) {
            this.groupDropEv(e);
        }
    },
    
    groupAddEv: function GigEdit$groupAddEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.maskOff();
        this.editor.grouper(this, true);
        this.editor.cancelAndSaveAll(e);
        this.maskOn();
    },
    
    groupStartEv: function GigEdit$groupStartEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.get_myGd().groupId = Formulas.get_newId();
        this.groupAddEv(e);
    },
    
    groupDropEv: function GigEdit$groupDropEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.maskOff();
        this.editor.grouper(this, false);
        this.editor.cancelAndSaveAll(e);
        this.maskOn();
    },
    
    _paddingEv$4: function GigEdit$_paddingEv$4(e, gd) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        var el = $(e.target);
        var cssName = el.attr('name');
        if (!el.data('hasKeys')) {
            el.data('hasKeys', true);
            el.unbind('keydown.keys');
            el.bind('keydown.keys', ss.Delegate.create(this, function(e2) {
                this._paddingKeys$4(e2, el, gd, cssName);
            }));
        }
    },
    
    _paddingKeys$4: function GigEdit$_paddingKeys$4(e, el, gd, cssName) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="el" type="jQueryObject">
        /// </param>
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="cssName" type="String">
        /// </param>
        window.setTimeout(ss.Delegate.create(this, function() {
            this.editor.forGroupById(e, gd.id, function(gi) {
                var v = GigEdit._propKeys$4(el, 0, 999) + 'px';
                gi.gd.css[cssName] = v;
                gi.gd.css[(cssName.indexOf('-top') > 0) ? 'padding-bottom' : 'padding-right'] = v;
                gi.el.css(gi.gd.css);
            });
        }), 50);
        this.queSave = true;
    },
    
    _roundingPie$4: function GigEdit$_roundingPie$4() {
        /// <returns type="String"></returns>
        var sz = parseInt(this.get_myCss()['border-radius'] || '0');
        var ot = '';
        ot += "<div><select class='BorderStyle' name='style' value='" + sz + "'>";
        ot += "<option value='none'>none</option>";
        ot += "<option value='solid'>solid</option>";
        ot += "<option value='dotted'>dotted</option>";
        ot += "<option value='dashed'>dashed</option>";
        ot += "<option value='double'>double</option>";
        ot += "<option value='groove'>groove</option>";
        ot += "<option value='ridge'>ridge</option>";
        ot += "<option value='inset'>inset</option>";
        ot += "<option value='outset'>outset</option>";
        ot += '</select></div>';
        ot += '<div><br>Rounding<br>';
        ot += "<input type='text' name='border-radius' size='2' value='" + sz + "'>pixels";
        ot += '</div>';
        var szx = parseInt(this.get_myCss()['padding'] || '0').toString();
        sz = parseInt((this.get_myCss()['padding-top'] || szx));
        ot += '<div><br>Padding vertical<br>';
        ot += "<input type='text' name='padding-top' size='2' value='" + sz + "'>pixels";
        ot += '</div>';
        sz = parseInt((this.get_myCss()['padding-left'] || szx));
        ot += '<div><br>Padding horizontal<br>';
        ot += "<input type='text' name='padding-left' size='2' value='" + sz + "'>pixels";
        ot += '</div>';
        return ot;
    },
    
    _borderBld$4: function GigEdit$_borderBld$4(gmu) {
        /// <param name="gmu" type="WhirliGig.Classes.GigMu">
        /// </param>
        var el = gmu.pie.find('select');
        el.bind('change', ss.Delegate.create(this, function(e) {
            e.shiftKey = ThemeBase.shiftKey;
            this.editor.forGroupById(e, this.id, function(gi) {
                Inform.debug('BorderBld shiftKey={0} id={1}', e.shiftKey, gi.gd.id);
                var stl = el.val();
                gi.gd.css['border-style'] = stl;
                Css.resetCss(gi.el);
                gi.el.css(gi.gd.css);
            });
            this.queSave = true;
        }));
        el.val(this.get_myCss()['border-style'] || 'none');
    },
    
    _roundingEv$4: function GigEdit$_roundingEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var el = $(e.target);
        el.closest('.Pie').removeClass('Selected');
        el.focus();
        this.editor.forGroupById(e, this.get_myGd().id, ss.Delegate.create(this, function(gi) {
            var n = el.attr('name');
            if (n != null && n.indexOf('padding') !== -1) {
                this._paddingEv$4(e, gi.gd);
            }
            else if (n != null && n === 'style') {
                return;
            }
            if (!el.data('hasKeys')) {
                el.data('hasKeys', true);
                el.unbind('keydown.keys');
                el.bind('keydown.keys', ss.Delegate.create(this, function(e2) {
                    this._roundingKeys$4(e2, el, gi.gd);
                }));
            }
        }));
    },
    
    _roundingKeys$4: function GigEdit$_roundingKeys$4(e, el, gd) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="el" type="jQueryObject">
        /// </param>
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        window.setTimeout(ss.Delegate.create(this, function() {
            this.editor.forGroupById(e, gd.id, function(gi) {
                var v = GigEdit._propKeys$4(el, 0, 999) + 'px';
                gi.gd.css['border-radius'] = v;
                gi.gd.css['-moz-border-radius'] = v;
                gi.gd.css['-webkit-border-radius'] = v;
                Css.resetCss(gi.el);
                GigShow.mapCss(gi.gd, gi.el, gi.gd.css);
            });
        }), 50);
        this.queSave = true;
    },
    
    _colorPickerTable$4: function GigEdit$_colorPickerTable$4(label, colorName) {
        /// <param name="label" type="String">
        /// </param>
        /// <param name="colorName" type="String">
        /// </param>
        /// <returns type="String"></returns>
        var ot = '';
        ot += "<div title='transparent'>" + label + ' ';
        ot += "<span class='Transparent' title='none'>x</span>";
        ot += "<span class='Transparent' title='transparent'>&#9744;</span>";
        ot += '</div>';
        ot += Await.files['ColorPickerTable'];
        ot += "<div class='Opaque'>Opaque <input type='text' size='2' class='" + colorName + "' value='" + (Css.alphaPercent(this.get_myCss()[colorName]) || '') + "'>%</div>";
        return ot;
    },
    
    _colorOpacityKeys$4: function GigEdit$_colorOpacityKeys$4(e, colorName) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="colorName" type="String">
        /// </param>
        var el = $(e.target);
        window.setTimeout(ss.Delegate.create(this, function() {
            this.editor.forGroupById(e, this.get_myGd().id, function(gi) {
                var cv = GigEdit._propKeys$4(el, 0, 100);
                var css = gi.gd.css;
                var c = Css.getColor(css[colorName]);
                c.opacity = cv / 100;
                var color = c.toString();
                css[colorName] = color;
                Css.resetCss(gi.el);
                gi.el.css(css);
            });
        }), 50);
        this.queSave = true;
    },
    
    _pickColorGv$4: function GigEdit$_pickColorGv$4(e, colorName) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="colorName" type="String">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, function(gi) {
            GigShowEdit.gigEditById(gi.gd.id).pickColorEv(e, colorName);
        });
    },
    
    pickColorEv: function GigEdit$pickColorEv(e, colorName) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="colorName" type="String">
        /// </param>
        var el = $(e.target);
        var color = el.attr('title');
        var css = this.get_myGd().css;
        if (el.is('input[type=text]')) {
            if (!el.data('hasKeys')) {
                el.data('hasKeys', true);
                el.unbind('keydown.keys');
                el.bind('keydown.keys', ss.Delegate.create(this, function(e2) {
                    this._colorOpacityKeys$4(e2, colorName);
                }));
            }
            el.focus();
        }
        else if (color != null) {
            if (color !== 'none') {
                var c1 = Css.getColor(css[colorName]);
                var c2 = Css.getColor(color);
                c2.opacity = (color === 'transparent') ? 0 : c1.opacity;
                css[colorName] = c2.toString();
                this._setOpacity$4(this.get_myGd(), colorName, (!c2.opacity && color !== 'transparent') ? 1 : c2.opacity);
            }
            else {
                delete css[colorName];
            }
            Css.resetCss(this.element);
            this.element.css(css);
            this.queSave = true;
        }
        DomElement.cancelEvent(e);
    },
    
    _pickBgColorEv$4: function GigEdit$_pickBgColorEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this._pickColorGv$4(e, 'background-color');
    },
    
    pickFgColorEv: function GigEdit$pickFgColorEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this._pickColorGv$4(e, 'color');
    },
    
    _pickBdrColorEv$4: function GigEdit$_pickBdrColorEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, ss.Delegate.create(this, function(gi) {
            var css = gi.gd.css;
            GigShowEdit.gigEditByEl(gi.el).pickColorEv(e, 'border-color');
            css['border-style'] = this._bdrStyle$4(gi.gd);
            css['border-width'] = this._bdrWidth$4(gi.gd);
            Css.resetCss(gi.el);
            gi.el.css(css);
        }));
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _bdrStyle$4: function GigEdit$_bdrStyle$4(gd, style) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="style" type="String">
        /// </param>
        /// <returns type="String"></returns>
        var css = gd.css;
        var stl = style || css['border-style'] || 'solid';
        stl = (stl === 'none') ? 'solid' : stl;
        $('.BorderStyle', this.get_gmu().pad).val(stl);
        if (!this._getOpacity$4(gd, 'border-color')) {
            this._setOpacity$4(gd, 'border-color', 1);
        }
        return stl;
    },
    
    _bdrWidth$4: function GigEdit$_bdrWidth$4(gd, bw) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="bw" type="String">
        /// </param>
        /// <returns type="String"></returns>
        var w = bw || Css.borderWidth(gd.css, 1).toString();
        var v = parseInt(w).toString();
        $('.border-width', this.get_gmu().pad).filter(function() {
            return $(this).html() === v;
        }).addClass('Selected');
        return v + 'px';
    },
    
    _getOpacity$4: function GigEdit$_getOpacity$4(gd, name) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="name" type="String">
        /// </param>
        /// <returns type="Number"></returns>
        return Css.getColor(gd.css[name] || Css.white).opacity;
    },
    
    _setOpacity$4: function GigEdit$_setOpacity$4(gd, name, op) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="name" type="String">
        /// </param>
        /// <param name="op" type="Number">
        /// </param>
        var c = Css.getColor(gd.css[name]);
        c.opacity = op;
        gd.css[name] = c.toString();
        $('.Opaque .' + name, this.get_gmu().pad).val((c.opacity * 100).toString());
    },
    
    _borderSzEv$4: function GigEdit$_borderSzEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, ss.Delegate.create(this, function(gi) {
            var sz = parseInt(($(e.target).data('value') || '1'));
            var css = gi.gd.css;
            css['border-color'] = css['border-color'] || this.get_myPgInvBgColor();
            css['border-style'] = this._bdrStyle$4(gi.gd);
            css['border-width'] = this._bdrWidth$4(gi.gd, sz + 'px');
            gi.el.css(css);
        }));
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _fontSzEv$4: function GigEdit$_fontSzEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, function(gi) {
            var sz = parseInt($(e.target).data('value'));
            var css = gi.gd.css;
            css['font-size'] = sz + 'pt';
            gi.el.css(css);
        });
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _fontFamilyEv$4: function GigEdit$_fontFamilyEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, function(gi) {
            var font = $(e.target).data('value');
            var css = gi.gd.css;
            css['font-family'] = font;
            gi.el.css(css);
        });
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _fontStlEv$4: function GigEdit$_fontStlEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, ss.Delegate.create(this, function(gi) {
            var stl = $(e.target).data('value');
            var css = gi.gd.css;
            css[this.get_gmu().pdp.prop] = stl;
            gi.el.css(css);
        }));
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _fontAlignEv$4: function GigEdit$_fontAlignEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.editor.forGroupById(e, this.get_myGd().id, function(gi) {
            var stl = $(e.target).data('value');
            var css = gi.gd.css;
            css['text-align'] = stl;
            gi.el.css(css);
        });
        this.queSave = true;
        DomElement.cancelEvent(e);
    },
    
    _doubleClickEv$4: function GigEdit$_doubleClickEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var dbk = this.element.data('doubleclick');
        if (dbk != null) {
            dbk(e);
        }
        else {
            this._editTextEv$4(e);
        }
    },
    
    _editTextEv$4: function GigEdit$_editTextEv$4(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var escape = false;
        var el = this.element;
        var cfg = GigShow.cssMap[this.get_myGd().type];
        if (cfg == null || !cfg.doubleclick) {
            DomElement.cancelEvent(e);
            return;
        }
        var isList = !String.isNullOrEmpty(this.get_myGd().listType);
        ThemeYoshi.supressCurateEvents = true;
        var ctt = el.children().first().find(cfg.inner).first();
        this.editor.muffel();
        el.find('.Cover').hide();
        var css = this.get_myGd().css;
        var css2 = $.extend({}, css);
        delete css2.margin;
        delete css2.padding;
        delete css2['border-style'];
        delete css2['border-width'];
        delete css2['padding-top'];
        delete css2['padding-left'];
        delete css2['padding-right'];
        delete css2['padding-bottom'];
        css2['overflow'] = 'hidden';
        if (cfg.css) {
            var pv = Css.paddingTop(css, Gig.deefCss['padding-top']);
            var ph = Css.paddingLeft(css, Gig.deefCss['padding-left']);
            css2['color'] = ctt.css('color');
            css2['background-color'] = Css.realBgColor(ctt);
            var p = ctt.offset();
            $.extend(css2, { top: p.top, left: p.left, width: ctt.innerWidth() - ph - ph, height: ctt.innerHeight() - pv - pv });
            $.extend(css2, { 'padding-left': ph, 'padding-right': ph, 'padding-top': pv, 'padding-bottom': 0 });
        }
        else {
            delete css2['border-radius'];
            delete css2['-moz-border-radius'];
            delete css2['-webkit-border-radius'];
            css2['color'] = el.css('color');
            css2['background-color'] = Css.realBgColor(el);
            var p = ctt.offset();
            $.extend(css2, { top: p.top - 1, left: p.left - 2, width: ctt.innerWidth() + 4, height: ctt.innerHeight() + 2 });
            $.extend(css2, { 'padding-left': 2, 'padding-right': 2, 'padding-top': 1, 'padding-bottom': 1 });
        }
        if (cfg.inner === 'button') {
            css2['text-align'] = 'center';
        }
        var wrap = (isList) ? 'off' : 'soft';
        var tx = $("<textarea class='GigEditText AboveHider' wrap='" + wrap + "' style='position:absolute;padding:0;margin:0;border: 0px none transparent'/>");
        var sw = el.innerWidth();
        var sh = el.innerHeight();
        var value = ctt.getContent();
        Cluster.glass(function() {
            tx.blur();
        }).css({ 'background-color': 'rgba(0,0,0,.25)' });
        var editKeys = { '13:s': function(ek) {
            DomElement.cancelEvent(ek);
            Cluster.glassOff();
        }, '27:': function(ek) {
            DomElement.cancelEvent(ek);
            escape = true;
            Cluster.glassOff();
        }, '9:': function(ek) {
            DomElement.cancelEvent(ek);
            Helpers.insertText(tx, '\t');
        } };
        tx.appendTo(document.body).css(css2).fValue(GigParse.htmlToList(value, this.get_myGd().listType)).bind('blur.editev', ss.Delegate.create(this, function() {
            ThemeYoshi.supressCurateEvents = false;
            DomElement.trigger('TabLineCounter', false);
            GigShow.mapCss(this.get_myGd(), el, css);
            ctt.show();
            var w = tx.innerWidth();
            var h = tx.innerHeight();
            if (w >= sw + 10) {
                el.css({ width: w });
            }
            if (h >= sh + 10) {
                el.css({ height: h });
            }
            if (!escape) {
                var txt = GigParse.listToHtml(tx.getFEditString(), this.get_myGd().listType);
                txt = (String.isNullOrEmpty(txt.trim())) ? '-- double-click here to edit --' : txt;
                var elx = el.find(cfg.inner);
                elx.setContent(txt);
                this.get_myGd().html = GigEdit.replaceText(this.get_myGd().html, txt);
            }
            ctt.show();
            el.find('.Cover').show();
            el.find('.CoverInner').show();
            tx.unbind('.editev').remove();
            this.editor.reSlideAndSave(e);
            Cluster.glassOff(true);
            this.editor.listen();
        })).bind('keydown.editev', function(e2) {
            var k = Keys.doKeys(e2, editKeys);
            if (k == null) {
                return;
            }
            if (isList) {
                if (e2.which === 13) {
                    window.setTimeout(function() {
                        tx.val(tx.val().replace(/[\n]([^\t])|\n$/g, '\n\t$1'));
                    }, 1);
                }
                else if (e2.which === 8) {
                    window.setTimeout(function() {
                        tx.val(tx.val().replace(/[\n]([^\t])|\n$/g, '$1'));
                    }, 1);
                }
            }
        }).click().focus().carotToEnd();
        if (tx.val() === '-- double-click here to edit --') {
            tx.val('');
        }
        GigEdit.textAreaExpander(tx);
        ctt.hide();
        if (isList) {
            DomElement.trigger('TabLineCounter', tx);
        }
        DomElement.cancelEvent(e);
    },
    
    delayScoopSize: function GigEdit$delayScoopSize(url, endTime) {
        /// <param name="url" type="String">
        /// </param>
        /// <param name="endTime" type="Number" integer="true">
        /// </param>
        /// <returns type="GigEdit"></returns>
        endTime = (ss.isValue(endTime)) ? endTime : new Date().getTime() + 60000;
        var h = this.element.height();
        if (h > 0) {
            var gd = this.get_myGd();
            gd.dim = new WhirliGig.Classes.Dimension();
            gd.dim.width = this.element.width();
            gd.dim.height = h;
            ImageManager.updateImageDataAw(Await.get_asyncAw(), url);
            this.saveAll();
        }
        else if (new Date().getTime() < endTime) {
            new Await().sleep(13).addDx(ss.Delegate.create(this, function() {
                this.delayScoopSize(url, endTime);
            })).commit();
        }
        return this;
    },
    
    saveAll: function GigEdit$saveAll() {
        /// <returns type="GigEdit"></returns>
        this.editor.saveAllAw(Await.get_asyncAw());
        return this;
    },
    
    draggable: function GigEdit$draggable(opt, doneFn) {
        /// <param name="opt" type="Object">
        /// </param>
        /// <param name="doneFn" type="Function">
        /// </param>
        this.element.draggable(opt);
        this.element.bind('dragstop.Gig', doneFn);
    }
}


////////////////////////////////////////////////////////////////////////////////
// GigShowEdit

GigShowEdit = function GigShowEdit() {
    /// <field name="gseInstance" type="GigShowEdit" static="true">
    /// </field>
    /// <field name="_bottom$3" type="Number" integer="true">
    /// </field>
    /// <field name="_focused$3" type="GigEdit">
    /// </field>
    /// <field name="_lastGroupId$3" type="String">
    /// </field>
    /// <field name="_paintedId$3" type="String">
    /// </field>
    /// <field name="afterDragName" type="String" static="true">
    /// </field>
    /// <field name="maskClassName" type="String" static="true">
    /// </field>
    /// <field name="_snapToNone$3" type="jQueryObject">
    /// </field>
    /// <field name="_group$3" type="Array">
    /// </field>
    /// <field name="_reIds$3" type="Object">
    /// </field>
    /// <field name="_snapToEl$3" type="jQueryObject">
    /// </field>
    /// <field name="_snapToReal$3" type="jQueryObject">
    /// </field>
    /// <field name="_snapToH$3" type="Number">
    /// </field>
    /// <field name="_snapToPos$3" type="Array" elementType="Number">
    /// </field>
    /// <field name="_snapToW$3" type="Number">
    /// </field>
    /// <field name="_stX$3" type="Number" integer="true">
    /// </field>
    /// <field name="_stY$3" type="Number" integer="true">
    /// </field>
    /// <field name="_dragOptions$3" type="Object">
    /// </field>
    this._snapToNone$3 = jQuery();
    GigShowEdit.initializeBase(this);
    GigShowEdit.gseInstance = this;
    TestInstance.addInstance(this);
    this._dragOptions$3 = { start: ss.Delegate.create(this, this._dragStart$3), drag: ss.Delegate.create(this, this._dragDrag$3), stop: ss.Delegate.create(this, this._dragStop$3) };
    new Await().loadScript(Uri.scriptsNd('Scripts/ParseXmlLib.js')).commit();
    new Await().loadJson('insertables', Uri.scripts('Data/insertables.txt')).commit();
    $(document).bind('SaveSpinnerOn', GigShowEdit.saveSpinnerOnEv);
    $(document).bind('SaveSpinnerOff', GigShowEdit.saveSpinnerOffEv);
    this.listen();
}
GigShowEdit.uploadImgEv = function GigShowEdit$uploadImgEv(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    new Await().loadAndDo(Uri.scripts('Scripts/PhotoUpload.js'), 'PhotoUploadViewer.Ev', { Path: 'pg/images' }, e).commit();
}
GigShowEdit.groupIt = function GigShowEdit$groupIt(id, gid) {
    /// <param name="id" type="String">
    /// </param>
    /// <param name="gid" type="String">
    /// </param>
    var gd = GigShow.instance.gigById(id);
    gd.groupId = gid;
    var el = GigShow.gigElById(id);
    el.addClass('Group GID' + gid);
    var ge = GigShowEdit.gigEditByEl(el);
    ge.maskOff();
    ge.maskOn();
}
GigShowEdit._collision$3 = function GigShowEdit$_collision$3(g1, g2) {
    /// <summary>
    /// Any part of g1 overlapps g2.
    /// </summary>
    /// <param name="g1" type="WhirliGig.Classes.GigData">
    /// GigData
    /// </param>
    /// <param name="g2" type="WhirliGig.Classes.GigData">
    /// GigData
    /// </param>
    /// <returns type="Boolean"></returns>
    var bw = Css.borderWidth(g1.css);
    var ph1 = Css.paddingHorz(g1.css) + bw;
    if (g1.pos.left + g1.dim.width + ph1 < g2.pos.left - bw) {
        return false;
    }
    if (g1.pos.left - bw > g2.pos.left + g2.dim.width + ph1) {
        return false;
    }
    var ph2 = Css.paddingVert(g2.css) + bw;
    if (g1.pos.top - bw > g2.pos.top + g2.dim.height + ph2) {
        return false;
    }
    if (g1.pos.top + g1.dim.height + ph2 < g2.pos.top - bw) {
        return false;
    }
    return true;
}
GigShowEdit.linkifyContent = function GigShowEdit$linkifyContent(gd, url) {
    /// <param name="gd" type="WhirliGig.Classes.GigData">
    /// </param>
    /// <param name="url" type="String">
    /// </param>
    var dl = GigEdit.domify(gd.html);
    var el = GigEdit.domContent(dl);
    if (el.parent().is('a')) {
        el.unwrap();
    }
    if (!String.isNullOrEmpty(url)) {
        el.wrap("<a href='" + ThemeYoshi.SmartUrl(url) + "'/>");
    }
    gd.html = DomElement.outerHtml(dl);
    dl.remove();
}
GigShowEdit.linkHref = function GigShowEdit$linkHref(gd) {
    /// <param name="gd" type="WhirliGig.Classes.GigData">
    /// </param>
    /// <returns type="String"></returns>
    var dl = GigEdit.domify(gd.html);
    var href = ThemeYoshi.UnSmartUrl(dl.find('a').attr('href') || '');
    dl.remove();
    return href;
}
GigShowEdit.saveSpinnerOnEv = function GigShowEdit$saveSpinnerOnEv(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    window.setTimeout(function() {
        $('#GearsBtnOuter').addClass('GearsGrinding');
        $('#GearsBtn').attr('src', Uri.img('Common/spinner16.gif'));
    }, 1);
}
GigShowEdit.saveSpinnerOffEv = function GigShowEdit$saveSpinnerOffEv(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    window.setTimeout(function() {
        $('#GearsBtnOuter').removeClass('GearsGrinding');
        $('#GearsBtn').attr('src', Uri.img('Common/gear16.gif'));
    }, 300);
}
GigShowEdit.dropListen = function GigShowEdit$dropListen(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    el.unbind('drop.Gig').bind('drop.Gig', ss.Delegate.create(GigShowEdit.gseInstance, GigShowEdit.gseInstance.createDropItemEv)).unbind('dragover.Gig').bind('dragover.Gig', DropTarget.dragOverEv);
}
GigShowEdit.fixEv = function GigShowEdit$fixEv(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    DomElement.cancelEvent(e);
    var awx = new Await();
    var $dict1 = ThemeYoshi.pages.pages;
    for (var $key2 in $dict1) {
        var pk = { key: $key2, value: $dict1[$key2] };
        awx.addAw(GigShowEdit._fixClosure$3(pk.value));
    }
    awx.commit();
    Uri.bumpVersion();
}
GigShowEdit._fixClosure$3 = function GigShowEdit$_fixClosure$3(pg) {
    /// <param name="pg" type="PageD">
    /// </param>
    /// <returns type="System.Action`1"></returns>
    return function(awp) {
        FileManager.updateFileAw(awp, Uri.join('pg/gigs', pg.Name), 'curator', function(slidesD) {
            var slides = slidesD;
            var $enum1 = ss.IEnumerator.getEnumerator(slides);
            while ($enum1.moveNext()) {
                var slide = $enum1.current;
                slide.css = $.extend({}, ThemeYoshi.defaultPageCss, slide.css);
                var gigs = slide.gigs;
                var $dict2 = gigs;
                for (var $key3 in $dict2) {
                    var gp = { key: $key3, value: $dict2[$key3] };
                    var gd = gp.value;
                    Inform.debug('Fixing page {0}, slide {1}, type {2}', pg.Name, slide.slide, gd.type);
                    switch (gd.type) {
                        case 'DropImage':
                            GigShowEdit._fixAddClass$3(gd, 'img', Gig.gigContentClassName);
                            break;
                        case 'TextItem':
                            gd.html = gd.html.replace(/<p[^>]*?>/g, "<div class='GigC'>").replaceAll('</p>', '</div>');
                            GigShowEdit._fixAddClass$3(gd, Gig.dotGigContentClassName, Gig.gigContentClassName);
                            break;
                        case 'TextBox':
                            GigShowEdit._fixAddClass$3(gd, 'input[type=text]', Gig.gigContentClassName);
                            break;
                        case 'TextArea':
                            GigShowEdit._fixAddClass$3(gd, 'textarea', Gig.gigContentClassName);
                            break;
                        case 'Button':
                            GigShowEdit._fixAddClass$3(gd, 'button', Gig.gigContentClassName);
                            break;
                        case 'EmbeddedCode':
                            break;
                        case 'ClassItem':
                            Inform.debug("We're good.");
                            break;
                        default:
                            break;
                    }
                }
            }
        });
    };
}
GigShowEdit._fixAddClass$3 = function GigShowEdit$_fixAddClass$3(gd, selector, className) {
    /// <param name="gd" type="WhirliGig.Classes.GigData">
    /// </param>
    /// <param name="selector" type="String">
    /// </param>
    /// <param name="className" type="String">
    /// </param>
    var cel = GigEdit.domifyContent(gd.html, selector);
    gd.html = GigShowEdit._fixRepContent$3(gd.html, DomElement.outerHtml(cel.addClass(className)), selector);
    cel.remove();
    Inform.debug('New html = {0}', gd.html);
}
GigShowEdit._fixRepContent$3 = function GigShowEdit$_fixRepContent$3(html, content, selector) {
    /// <param name="html" type="String">
    /// </param>
    /// <param name="content" type="String">
    /// </param>
    /// <param name="selector" type="String">
    /// </param>
    /// <returns type="String"></returns>
    selector = selector || Gig.dotGigContentClassName;
    var el = $(html).appendTo(document.body);
    el.find(selector).parent().setContent(content);
    var fx = $('div', el);
    if (el.is('div')) {
        fx.add(el[0]);
    }
    fx.removeAttr('style');
    var ot = DomElement.outerHtml(el);
    el.remove();
    return ot;
}
GigShowEdit.gigEditById = function GigShowEdit$gigEditById(id) {
    /// <param name="id" type="String">
    /// </param>
    /// <returns type="GigEdit"></returns>
    try {
        return GigShow.gigElById(id).data('gigEdit');
    }
    catch ($e1) {
        return null;
    }
}
GigShowEdit.gigEditByEl = function GigShowEdit$gigEditByEl(el) {
    /// <param name="el" type="jQueryObject">
    /// </param>
    /// <returns type="GigEdit"></returns>
    try {
        return el.data('gigEdit');
    }
    catch ($e1) {
        return null;
    }
}
GigShowEdit.prototype = {
    _bottom$3: 0,
    _focused$3: null,
    _lastGroupId$3: null,
    _paintedId$3: null,
    
    newGigEdit: function GigShowEdit$newGigEdit(gse) {
        /// <param name="gse" type="GigShow">
        /// </param>
        /// <returns type="Gig"></returns>
        return new GigEdit(gse);
    },
    
    configure: function GigShowEdit$configure(gd, igg) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="igg" type="Gig">
        /// </param>
        /// <returns type="Object"></returns>
        var gg = igg;
        if (!gd.noCover) {
            gg.addCover();
            var dl = -2 - Css.borderWidth(gd.css, 0);
            var adj = { top: dl, left: dl, right: dl, bottom: dl };
            gg.cover.css(adj);
            gg.coverInner.css(adj);
            if (gd.type === 'EmbeddedCode') {
                gg.cover.css({ top: dl - 22 });
                gg.coverInner.css({ top: dl - 22 });
            }
        }
        if (!String.isNullOrEmpty(gd.groupId)) {
            gg.element.addClass('Group GID' + gd.groupId);
        }
        else {
            gg.element.removeClass('Group GID' + gd.groupId);
        }
        var css = $.extend({}, gd.css);
        var cssI = {};
        cssI['opacity'] = css['opacity'];
        delete css.opacity;
        gg.content.css(cssI);
        return css;
    },
    
    undoStart: function GigShowEdit$undoStart(content, slide) {
        /// <param name="content" type="String">
        /// </param>
        /// <param name="slide" type="Number" integer="true">
        /// </param>
        Undo.start(new WhirliGig.Classes.UndoItem(content, slide), this.partitionKey);
    },
    
    pageMenu: function GigShowEdit$pageMenu() {
        this.clearPaint();
        if (this.slideControls == null) {
            return;
        }
        new Await().addDx(ss.Delegate.create(this, function() {
            this.slideControls.empty();
            var el = $("<div class='SlideSelect'/>").appendTo(this.slideControls);
            if (this._hasSelect) {
                var sel = $('<select/>').appendTo(el).change(ss.Delegate.create(this, this.changeSlideEv));
                var $enum1 = ss.IEnumerator.getEnumerator(this.slides);
                while ($enum1.moveNext()) {
                    var sd = $enum1.current;
                    $('<option/>').appendTo(sel).attr('value', sd.slide.toString()).html('slide ' + (sd.slide + 1));
                }
                sel.val(this.slide.toString());
                if (this.slides.length > 1) {
                    $("<span class='PrevSlide'/>").appendTo(el).html('<').attr('title', ThemeWhirliGig.prevSlideTitle).swallowClick(ss.Delegate.create(this, this.prevSlideEv));
                    $("<span class='NextSlide'/>").appendTo(el).html('>').attr('title', ThemeWhirliGig.nextSlideTitle).swallowClick(ss.Delegate.create(this, this.nextSlideEv));
                }
            }
            if (this.curating) {
                var gearsOuter = $("<div id='GearsBtnOuter' class='GearsBtnOuter'/>").appendTo(el);
                var gear = $("<img id='GearsBtn' class='GearsBtn'/>").attr('src', Uri.img('Common/gear16.gif')).appendTo(gearsOuter);
                var mu = new DDict();
                if (!this._playTmr) {
                    if (Nsb.Storage.getLocal('CopyBuffer') != null) {
                        mu.add('&#9679; Paste to this page', ss.Delegate.create(this, this.pasteEv));
                    }
                    if (Undo.hasPrior(this.partitionKey)) {
                        mu.add('&#9679; <b>&#8656; Undo</b> - <small>(ctrl-z)</small>', ss.Delegate.create(this, this.undoEv));
                    }
                    if (Undo.hasNext(this.partitionKey)) {
                        mu.add('&#9679; <b>Redo &#8658;</b> - <small>(ctrl-alt-z)</small>', ss.Delegate.create(this, this.redoEv));
                    }
                    if (!this._opts['NoSlides']) {
                        mu.add('Play slide show', ss.Delegate.create(this, this.playSlidesEv)).add('Copy this slide', ss.Delegate.create(this, this.copySlideEv)).add("<span style='font-family:Courier New'>+</span> Add new slide", ss.Delegate.create(this, this.addSlideEv)).add("<span style='font-family:Courier New'>-</span> Remove this slide", ss.Delegate.create(this, this.remSlideEv));
                    }
                    mu.add('addablesBar', '<b>Insert</b>').add('&#9679; Text', ss.Delegate.create(this, function(e, item) {
                        this.textItem();
                    })).add('&#9679; Numbered list', ss.Delegate.create(this, function(e, item) {
                        this.htmlOrderedList();
                    })).add('&#9679; Button', ss.Delegate.create(this, function(e, item) {
                        this.insertButton();
                    })).add('&#9679; Single-line form box', ss.Delegate.create(this, function(e, item) {
                        this.insertTextBox();
                    })).add('&#9679; Multi-line form box', ss.Delegate.create(this, function(e, item) {
                        this.insertTextareaBox();
                    })).add('&#9679; Page links box', ss.Delegate.create(this, function(e, item) {
                        this.insertLinks();
                    })).add('&#9679; Embedded html code', ss.Delegate.create(this, function(e, item) {
                        this.askEmbeddedCode();
                    })).add('commandsBar', '<b></b>').add('&#9679; Add images', GigShowEdit.uploadImgEv).add('&#9679; Admin page', function(e) {
                        Master.GoPage(ThemeYoshi.defaultPageClass,ThemeYoshi.adminPageName);
                    }).add('&#9679; Manage pages', ss.Delegate.create(this, this.pagesEv)).add('&#9679; Copy whole page', ss.Delegate.create(this, this.copySlideEv)).add('&#9679; Change page colors', ss.Delegate.create(this, function(e, item) {
                        this.colorizeBg();
                    })).add('&#9679; Change page background', ss.Delegate.create(this, function(e, item) {
                        this.addNewBg();
                    })).add('publishBar', '<b></b>').add('&#9679; Go to published page', ThemeYoshi.toPublished).add('&#9679; Turn curating off', ss.Delegate.create(this, this.curatingOff));
                }
                else {
                    mu.add('Stop slide show', ss.Delegate.create(this, this.stopSlidesEv));
                }
                new PopMenu().addList(mu.end()).wrapAround(gear).addClass('EditGears');
            }
        })).commit();
    },
    
    autoSize: function GigShowEdit$autoSize(gd) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        if (gd.autosize) {
            var el = $('#' + gd.id);
            if (el.length > 0) {
                var w = el.width();
                el.width(w - (($.browser.msie) ? 0 : 2));
                var carton = el.outerHeight() - el.height() - (parseInt(el.css('border-left-width') || '0') * 2);
                gd.dim.height = el.height('')[0].scrollHeight - carton;
                el.height(gd.dim.height);
                el.width(w);
            }
        }
    },
    
    saveAllAw: function GigShowEdit$saveAllAw(awp, noUndo) {
        /// <param name="awp" type="Await">
        /// </param>
        /// <param name="noUndo" type="Boolean">
        /// </param>
        new Await().addDx(ss.Delegate.create(this, function() {
            var cnt = 0;
            var $enum1 = ss.IEnumerator.getEnumerator(this.slides);
            while ($enum1.moveNext()) {
                var slide = $enum1.current;
                slide.slide = cnt++;
            }
            var content = this._serialize$3();
            if (content !== this.lastSaved) {
                if (!noUndo) {
                    Undo.save(new WhirliGig.Classes.UndoItem(content, this.slide), this.partitionKey);
                    this.redrawPageGear();
                }
                this.lastSaved = content;
                FileBlobBase.storeBlobStringAw(awp, { partitionKey: this.partitionKey, rowKey: this.rowKey, content: content, backup: true });
                DomElement.trigger('OnPageSave', this.get_currentSlide());
            }
            else {
                awp.done();
            }
        })).addFn(ss.Delegate.create(this, this.setMinPageHeight)).commit();
    },
    
    replaceSlides: function GigShowEdit$replaceSlides(slides, slide, noUndo) {
        /// <param name="slides" type="Array">
        /// </param>
        /// <param name="slide" type="Number" integer="true">
        /// </param>
        /// <param name="noUndo" type="Boolean">
        /// </param>
        if (ss.isValue(slides)) {
            this.slide = slide;
            this.slides = slides;
            new Await().addAw(ss.Delegate.create(this, this.restoreSlideAw), this.slide).addFn(ss.Delegate.create(this, this.redrawPageGear)).addAw(ss.Delegate.create(this, this.saveAllAw), noUndo).commit();
        }
    },
    
    undoEv: function GigShowEdit$undoEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var ui = Undo.prior(this.partitionKey);
        if (ui != null) {
            this.replaceSlides(WhirliGig.Classes.UndoItem.parse(ui.buffer), ui.slide, true);
        }
    },
    
    redoEv: function GigShowEdit$redoEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var ui = Undo.next(this.partitionKey);
        if (ui != null) {
            this.replaceSlides(WhirliGig.Classes.UndoItem.parse(ui.buffer), ui.slide, true);
        }
    },
    
    destroy: function GigShowEdit$destroy() {
        this.muffel();
        GigShowEdit.callBaseMethod(this, 'destroy');
    },
    
    pagesEv: function GigShowEdit$pagesEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        Cluster.glassOff();
        Pages.Ev(e);
    },
    
    collectGroup: function GigShowEdit$collectGroup(ev, gid) {
        /// <param name="ev" type="jQueryEvent">
        /// </param>
        /// <param name="gid" type="String">
        /// </param>
        /// <returns type="Array"></returns>
        var ls = [];
        if (!String.isNullOrEmpty(gid)) {
            $('.GID' + gid, GigShow.pageSelectToEl).each(ss.Delegate.create(this, function(i, domEl) {
                var gi = new WhirliGig.Classes.GroupItem();
                gi.el = $(domEl);
                if (gi.el.length > 0) {
                    gi.gd = this.gigById(gi.el[0].id);
                    gi.pos = $.extend({}, gi.gd.pos);
                    gi.e = ev;
                    ls.add(gi);
                }
            }));
        }
        return ls;
    },
    
    forCluster: function GigShowEdit$forCluster(e, fn) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="fn" type="System.Action`1">
        /// </param>
        var gd = this.get_focusedGd();
        this._group$3 = (e.shiftKey || gd.clusterId === gd.id) ? this.collectGroup(e, gd.groupId) : [];
        this._forGroupSub$3(e, gd, fn);
    },
    
    forGroup: function GigShowEdit$forGroup(e, fn) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="fn" type="System.Action`1">
        /// </param>
        var gd = this.get_focusedGd();
        this._group$3 = (e.shiftKey) ? this.collectGroup(e, gd.groupId) : [];
        this._forGroupSub$3(e, gd, fn);
    },
    
    forGroupById: function GigShowEdit$forGroupById(e, id, fn) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="id" type="String">
        /// </param>
        /// <param name="fn" type="System.Action`1">
        /// </param>
        var gd = this.gigById(id);
        this._group$3 = (e.shiftKey) ? this.collectGroup(e, gd.groupId) : [];
        this._forGroupSub$3(e, gd, fn);
    },
    
    _forGroupSub$3: function GigShowEdit$_forGroupSub$3(e, gd, fn) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="fn" type="System.Action`1">
        /// </param>
        if (!this._group$3.length) {
            this._group$3.add(new WhirliGig.Classes.GroupItem().fillFromGd(e, gd));
        }
        var $enum1 = ss.IEnumerator.getEnumerator(this._group$3);
        while ($enum1.moveNext()) {
            var gi = $enum1.current;
            fn(gi);
        }
    },
    
    ungroupIt: function GigShowEdit$ungroupIt(id, all) {
        /// <param name="id" type="String">
        /// </param>
        /// <param name="all" type="Boolean">
        /// </param>
        var gd = this.gigById(id);
        if (!String.isNullOrEmpty(gd.clusterId)) {
            Ask.ok(ThemeYoshi.unGroupClusterMsg);
            return;
        }
        GigShowEdit.gigEditById(id).maskOff();
        if (!String.isNullOrEmpty(gd.groupId)) {
            this._group$3 = this.collectGroup(null, gd.groupId);
            if (all || this._group$3.length <= 2) {
                var $enum1 = ss.IEnumerator.getEnumerator(this._group$3);
                while ($enum1.moveNext()) {
                    var gi = $enum1.current;
                    gi.gd.groupId = null;
                    gi.el.removeClass('Group GID' + gi.gd.groupId);
                }
            }
            else {
                GigShow.gigElById(gd.id).removeClass('Group GID' + gd.groupId);
                gd.groupId = null;
            }
        }
        this.clearPaint();
    },
    
    clearPaint: function GigShowEdit$clearPaint() {
        this._paintedId$3 = null;
    },
    
    grouper: function GigShowEdit$grouper(gg, addIt) {
        /// <param name="gg" type="GigEdit">
        /// </param>
        /// <param name="addIt" type="Boolean">
        /// </param>
        if (addIt) {
            if (String.isNullOrEmpty(this.get_focusedGd().groupId) || this._paintedId$3 == null) {
                if (this._paintedId$3 == null || this._paintedId$3 === this.get_focusedGd().id) {
                    this._paintedId$3 = this.get_focusedGd().id;
                    return;
                }
                this._lastGroupId$3 = this.gigById(this._paintedId$3).groupId || Formulas.get_newId();
                GigShowEdit.groupIt(this._paintedId$3, this._lastGroupId$3);
            }
            else {
                this._lastGroupId$3 = this.get_focusedGd().groupId;
            }
            GigShowEdit.groupIt(gg.id, this._lastGroupId$3);
            this._paintedId$3 = gg.id;
        }
        else {
            this.ungroupIt(gg.id);
        }
    },
    
    groupify: function GigShowEdit$groupify(gd, ify) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="ify" type="Boolean">
        /// </param>
        this._lastGroupId$3 = Formulas.get_newId();
        if (ify) {
            var $dict1 = this.get_currentSlide().gigs;
            for (var $key2 in $dict1) {
                var p = { key: $key2, value: $dict1[$key2] };
                if (GigShowEdit._collision$3(p.value, gd)) {
                    GigShowEdit.groupIt(p.value.id, this._lastGroupId$3);
                }
            }
        }
        else {
            this.ungroupIt(gd.id, true);
        }
        this.clearPaint();
    },
    
    _serialize$3: function GigShowEdit$_serialize$3() {
        /// <returns type="String"></returns>
        this._resort$3();
        var s = JSON.stringify(this.slides, function(n, o) {
            return o;
        }, 4);
        return s;
    },
    
    _resort$3: function GigShowEdit$_resort$3() {
        var gs = {};
        GigShow.pageSelectToEl.find(Gig.dotGigClassName).each(ss.Delegate.create(this, function(i, domEl) {
            var el = $(domEl);
            var id = el.attr('id');
            gs[id] = this.slides[this.slide].gigs[id];
        }));
        this.get_currentSlide().gigs = gs;
    },
    
    _reorder$3: function GigShowEdit$_reorder$3() {
        var g1 = [];
        var g2 = [];
        var $dict1 = this.get_currentSlide().gigs;
        for (var $key2 in $dict1) {
            var gig = { key: $key2, value: $dict1[$key2] };
            if (gig.value.embedded) {
                g1.add(gig.value);
            }
            else {
                g2.add(gig.value);
            }
        }
        g1.sort(ss.Delegate.create(this, this._sortTops$3));
        var pg = GigShow.pageSelectToEl;
        var gs = {};
        var $enum3 = ss.IEnumerator.getEnumerator(g2);
        while ($enum3.moveNext()) {
            var gd = $enum3.current;
            gs[gd.id] = gd;
            $('#' + gd.id).appendTo(pg);
        }
        var $enum4 = ss.IEnumerator.getEnumerator(g1);
        while ($enum4.moveNext()) {
            var gd = $enum4.current;
            gs[gd.id] = gd;
            $('#' + gd.id).appendTo(pg);
        }
        this.get_currentSlide().gigs = gs;
    },
    
    reEmbedEv: function GigShowEdit$reEmbedEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this._bottom$3 = 0;
        var grps = {};
        var $dict1 = this.get_currentSlide().gigs;
        for (var $key2 in $dict1) {
            var gig = { key: $key2, value: $dict1[$key2] };
            var gd = gig.value;
            if (!gd.embedded) {
                continue;
            }
            if (!String.isNullOrEmpty(gd.groupId)) {
                if (!(gd.groupId in grps)) {
                    grps[gd.groupId] = true;
                    this._reEmbedGrp$3(gd.groupId);
                }
                continue;
            }
            this.autoSize(gd);
            if (!!this._bottom$3) {
                this._reEmbed$3(gd, this._bottom$3);
            }
            this._bottom$3 = GigShow.gigElById(gd.id).offset().top + gd.dim.height + Css.offsetVert(gd.css, Gig.deefCss['padding-top']);
        }
    },
    
    _reEmbedGrp$3: function GigShowEdit$_reEmbedGrp$3(grp) {
        /// <param name="grp" type="String">
        /// </param>
        this._bottom$3 = 0;
        var $dict1 = this.get_currentSlide().gigs;
        for (var $key2 in $dict1) {
            var gig = { key: $key2, value: $dict1[$key2] };
            var gd = gig.value;
            if (!gd.embedded || gd.groupId !== grp) {
                continue;
            }
            this.autoSize(gd);
            if (!!this._bottom$3) {
                this._reEmbed$3(gd, this._bottom$3);
            }
            this._bottom$3 = GigShow.gigElById(gd.id).offset().top + gd.dim.height + Css.offsetVert(gd.css, Gig.deefCss['padding-top']);
        }
    },
    
    _reEmbed$3: function GigShowEdit$_reEmbed$3(gd, bottom) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="bottom" type="Number" integer="true">
        /// </param>
        var s = GigShow.gigElById(gd.id).offset().top;
        var n = bottom + (this.get_currentSlide().embedGap || 10);
        if (s !== n) {
            $('#' + gd.id).css({ top: gd.pos.top, left: gd.pos.left });
        }
    },
    
    reSizeEv: function GigShowEdit$reSizeEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        var $dict1 = this.get_currentSlide().gigs;
        for (var $key2 in $dict1) {
            var gig = { key: $key2, value: $dict1[$key2] };
            this.autoSize(gig.value);
        }
    },
    
    _sortTops$3: function GigShowEdit$_sortTops$3(a, b) {
        /// <param name="a" type="Object">
        /// </param>
        /// <param name="b" type="Object">
        /// </param>
        /// <returns type="Number" integer="true"></returns>
        return ((a).pos.top > (b).pos.top) ? 1 : -1;
    },
    
    listen: function GigShowEdit$listen() {
        GigShowEdit.dropListen($('#PageMaster'));
        $(document).unbind('keydown.Gig').bind('keydown.Gig', ss.Delegate.create(this, function(e) {
            var t = $(e.target);
            if (t.is('input, textarea, select')) {
                return;
            }
            if (e.which !== 16) {
                this.clearPaint();
            }
            if (ThemeYoshi.supressCurateEvents || !ThemeYoshi.pageDone) {
                return;
            }
            if (e.which === 66) {
                this.toBackEv(e);
            }
            else if (e.which === 67 && e.ctrlKey) {
                this.copyEv(e);
            }
            else if (e.which === 46 || e.which === 68 || e.which === 8) {
                this.deleteEv(e);
            }
            else if (e.which === 69 && !e.shiftKey && e.ctrlKey) {
                this.editElCssEv(e);
            }
            else if (e.which === 69 && e.shiftKey) {
                EditRawGigs.ev(e, this);
            }
            else if (e.which === 70 && !e.ctrlKey && !e.altKey) {
                this.toFrontEv(e);
            }
            else if (e.which === 70 && e.ctrlKey && e.altKey) {
                GigShowEdit.fixEv(e);
            }
            else if (e.which === 71 && !e.shiftKey) {
                this.get_focGigEdit().groupifyEv(e);
            }
            else if (e.which === 71 && e.shiftKey) {
                this.get_focGigEdit().ungroupEv(e);
            }
            else if (e.which === 72) {
                this.toHigherEv(e);
            }
            else if (e.which === 76) {
                this.toLowerEv(e);
            }
            else if (e.which === 80 && !e.ctrlKey) {
                Pages.Ev(e);
            }
            else if (e.which === 84) {
                this.get_focGigEdit().gearsOnEv(e);
            }
            else if (e.which === 86 && e.ctrlKey) {
                this.pasteEv(e);
            }
            else if (e.which === 90 && !e.ctrlKey && !e.altKey) {
                this.get_focGigEdit().zeroEv(e);
            }
            else if (e.which === 90 && e.ctrlKey && !e.altKey) {
                this.undoEv(e);
            }
            else if (e.which === 90 && e.ctrlKey && e.altKey) {
                this.redoEv(e);
            }
            else if (e.which === 39) {
                this.nextPageEv(e);
            }
            else if (e.which === 37) {
                this.priorPageEv(e);
            }
        }));
    },
    
    muffel: function GigShowEdit$muffel() {
        $('body').unbind('dragover.Gig').unbind('drop.Gig');
        $(document).unbind('keydown.Gig');
    },
    
    updateGigAw: function GigShowEdit$updateGigAw(awp, fnModify, fnComplete) {
        /// <param name="awp" type="Await">
        /// </param>
        /// <param name="fnModify" type="System.Action`1">
        /// </param>
        /// <param name="fnComplete" type="Function">
        /// </param>
        FileManager.updateFileAw(awp, this.partitionKey, this.rowKey, fnModify, fnComplete);
    },
    
    addNewBg: function GigShowEdit$addNewBg() {
        new Await().addDl(ss.Delegate.create(this, function(aw) {
            this.updateGigAw(aw, function(slidesD) {
                var gigs = (slidesD)[0];
                gigs.hasBackground = true;
                Uri.bumpVersion();
            });
        })).addAw(ss.Delegate.create(new Ask(), new Ask().fileUploadAw), { Msg: 'Upload new background image', path: Uri.join('pg/gigs/', ThemeYoshi.currentPageName), filename: this.get_bgImgName(), password: Nsb.Storage.getLocal(ThemeYoshi.get_curatePasswordKey()) }).addAw(DomElement.requireResultAw, DomElement.notFailOrEmpty).commit();
    },
    
    colorizeBg: function GigShowEdit$colorizeBg() {
        var mo = new WhirliGigEdit.Classes.ModOptions();
        mo.isPgBackground = true;
        mo.prop = 'background-color';
        mo.toChange = $('body');
        mo.toStore = this.get_currentSlide().css;
        mo.title = 'page background color';
        mo.onChange = ss.Delegate.create(this, this.stdCssSet);
        mo.onSave = ss.Delegate.create(this, function() {
            this.saveAllAw(Await.get_asyncAw());
        });
        new Colorizer(mo);
    },
    
    stdCssSet: function GigShowEdit$stdCssSet(opts, v) {
        /// <param name="opts" type="WhirliGigEdit.Classes.ModOptions">
        /// </param>
        /// <param name="v" type="Object">
        /// </param>
        var cc = v;
        opts.toChange.css(opts.prop, cc);
        opts.toStore[opts.prop] = cc;
        if (opts.isPgBackground) {
            this.setBackgroundColor(cc);
        }
    },
    
    get_hasFocus: function GigShowEdit$get_hasFocus() {
        /// <value type="Boolean"></value>
        try {
            return this.get_focGigEdit().element.find('div.Sizer').is(':visible') || $('div.GigMu').is(':visible');
        }
        catch ($e1) {
            return false;
        }
    },
    
    get_focGigEdit: function GigShowEdit$get_focGigEdit() {
        /// <value type="GigEdit"></value>
        return this._focused$3 || Exceptions.get_nullReferenceException();
    },
    set_focGigEdit: function GigShowEdit$set_focGigEdit(value) {
        /// <value type="GigEdit"></value>
        this._focused$3 = value;
        DomElement.unfocus();
        return value;
    },
    
    get_focusedGd: function GigShowEdit$get_focusedGd() {
        /// <value type="WhirliGig.Classes.GigData"></value>
        return this.slides[this.slide].gigs[this.get_focGigEdit().element.attr('id')] || Exceptions.get_nullReferenceException();
    },
    
    el: function GigShowEdit$el() {
        /// <returns type="jQueryObject"></returns>
        return this.get_focGigEdit().element;
    },
    
    _group$3: null,
    _reIds$3: null,
    _snapToEl$3: null,
    _snapToReal$3: null,
    _snapToH$3: 0,
    _snapToPos$3: null,
    _snapToW$3: 0,
    _stX$3: 0,
    _stY$3: 0,
    _dragOptions$3: null,
    
    makeDraggable: function GigShowEdit$makeDraggable(gg) {
        /// <param name="gg" type="Gig">
        /// </param>
        gg.draggable(this._dragOptions$3, function() {
        });
    },
    
    setGigEv: function GigShowEdit$setGigEv(e, prop, value) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="prop" type="String">
        /// </param>
        /// <param name="value" type="Object">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        this.forGroup(e, function(gi) {
            if (value != null) {
                gi.gd[prop] = value;
            }
            else {
                delete gi.gd[prop];
            }
        });
        this.reSlide(e);
    },
    
    bailNoFocusEv: function GigShowEdit$bailNoFocusEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <returns type="Boolean"></returns>
        if (!this.get_hasFocus()) {
            DomElement.cancelEvent(e);
            Cluster.flashWindow();
            return true;
        }
        return false;
    },
    
    cancelAndSaveAll: function GigShowEdit$cancelAndSaveAll(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.saveAllAw(Await.get_asyncAw());
        DomElement.cancelEvent(e);
    },
    
    reSlideAndSave: function GigShowEdit$reSlideAndSave(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        this.reEmbedEv(e);
        this.reSizeEv(e);
        new Await().addAw(ss.Delegate.create(this, this.restoreSlideAw), this.slide).addDx(ss.Delegate.create(this, function() {
            this.cancelAndSaveAll(e);
        })).commit();
    },
    
    reSlide: function GigShowEdit$reSlide(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        this.reEmbedEv(e);
        this.reSizeEv(e);
        this.restoreSlideAw(Await.get_asyncAw(), this.slide);
    },
    
    createDropItemEv: function GigShowEdit$createDropItemEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (typeof(e.pageX) !== 'number') {
            e.pageX = e.originalEvent.pageX || e.originalEvent.clientX;
            e.pageY = e.originalEvent.pageY || e.originalEvent.clientY;
        }
        var drop = DropTarget.dropObject(e);
        if (drop['url'] != null) {
            this.imageItem(drop['url'], e.pageX, e.pageY);
        }
    },
    
    toFrontEv: function GigShowEdit$toFrontEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        this.forGroup(e, function(gi) {
            gi.el.appendTo(gi.el.parent());
        });
        this.cancelAndSaveAll(e);
    },
    
    toBackEv: function GigShowEdit$toBackEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        this.forGroup(e, function(gi) {
            gi.el.prependTo(gi.el.parent());
        });
        this.cancelAndSaveAll(e);
    },
    
    toHigherEv: function GigShowEdit$toHigherEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        this.forGroup(e, function(gi) {
            gi.el.next().insertBefore(gi.el);
        });
        this.cancelAndSaveAll(e);
    },
    
    toLowerEv: function GigShowEdit$toLowerEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        this.forGroup(e, function(gi) {
            gi.el.prev().insertAfter(gi.el);
        });
        this.cancelAndSaveAll(e);
    },
    
    floatEv: function GigShowEdit$floatEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'floated', true);
    },
    
    unFloatEv: function GigShowEdit$unFloatEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'floated', false);
    },
    
    embeddedEv: function GigShowEdit$embeddedEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'embedded', true);
    },
    
    unEmbeddedEv: function GigShowEdit$unEmbeddedEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'embedded', false);
    },
    
    autosizeEv: function GigShowEdit$autosizeEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'autosize', true);
    },
    
    unAutosizeEv: function GigShowEdit$unAutosizeEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'autosize', false);
    },
    
    formatUlEv: function GigShowEdit$formatUlEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'listType', 'ul');
    },
    
    formatOlEv: function GigShowEdit$formatOlEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'listType', 'ol');
    },
    
    formatPlainEv: function GigShowEdit$formatPlainEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.setGigEv(e, 'listType', null);
    },
    
    nextPageEv: function GigShowEdit$nextPageEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        var pp = Object.keys(ThemeYoshi.pages.pages);
        var i = 0;
        var $enum1 = ss.IEnumerator.getEnumerator(pp);
        while ($enum1.moveNext()) {
            var s = $enum1.current;
            if (s === ThemeYoshi.currentPageName) {
                break;
            }
            i++;
        }
        var nxt = (i === pp.length - 1) ? pp[0] : pp[i + 1];
        ThemeYoshi.goPage(ThemeYoshi.currentPageClass, nxt);
    },
    
    priorPageEv: function GigShowEdit$priorPageEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        DomElement.cancelEvent(e);
        var pp = Object.keys(ThemeYoshi.pages.pages);
        var i = 0;
        var $enum1 = ss.IEnumerator.getEnumerator(pp);
        while ($enum1.moveNext()) {
            var s = $enum1.current;
            if (s === ThemeYoshi.currentPageName) {
                break;
            }
            i++;
        }
        var nxt = (i <= 0) ? pp[pp.length - 1] : pp[i - 1];
        ThemeYoshi.goPage(ThemeYoshi.currentPageClass, nxt);
    },
    
    editElCssEv: function GigShowEdit$editElCssEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        var id = this.get_focusedGd().id;
        new Await().addAw(ss.Delegate.create(new EditCss(), new EditCss().editDAw), this.get_focusedGd()).addAw(DomElement.requireResultAw, DomElement.notFail).addDl(ss.Delegate.create(this, function(aw) {
            try {
                var d = aw.get_result();
                var sd = this.get_currentSlide();
                if (('css' in d)) {
                    sd.gigs[id] = d;
                }
                else {
                    sd.gigs[id].css = d;
                }
                this.reSlideAndSave(e);
            }
            catch (ex) {
                Inform.error('Exception updating gig css: {0}', ex);
            }
        })).commit();
    },
    
    deleteEv: function GigShowEdit$deleteEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        var awx = new Await();
        if (!e.altKey) {
            awx.addAw(ss.Delegate.create(new Ask(), new Ask().okCancelAw), ThemeYoshi.forSure).addAw(DomElement.requireResultAw, true);
        }
        awx.addDx(ss.Delegate.create(this, function() {
            this.forCluster(e, ss.Delegate.create(this, function(gi) {
                GigShow.gigElById(gi.gd.id).remove();
                delete this.get_currentSlide().gigs[gi.gd.id];
            }));
            this.reSlideAndSave(e);
            Cluster.glassOff();
        })).commit();
        DomElement.cancelEvent(e);
    },
    
    copyEv: function GigShowEdit$copyEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this.bailNoFocusEv(e)) {
            return;
        }
        var items = [];
        this.forCluster(e, function(gi) {
            items.add(gi.gd);
        });
        Nsb.Storage.setLocal('CopyBuffer', items);
        Cluster.glassOff();
        this.redrawPageGear();
        DomElement.cancelEvent(e);
    },
    
    pasteEv: function GigShowEdit$pasteEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var gdl = Nsb.Storage.getLocal('CopyBuffer');
        if (gdl != null) {
            this._reIds$3 = {};
            if (!$.isArray(gdl)) {
                gdl = [gdl];
            }
            var awx = new Await();
            if (gdl.length === 1) {
                var gd = gdl[0];
                gd.groupId = null;
                gd.parentId = null;
                gd.clusterId = null;
            }
            var $enum1 = ss.IEnumerator.getEnumerator(gdl);
            while ($enum1.moveNext()) {
                var item = $enum1.current;
                this._pasteClosure$3(awx, item);
            }
            awx.addDx(ss.Delegate.create(this, function() {
                Nsb.Storage.setLocal('CopyBuffer', gdl);
                this.reSlideAndSave(e);
                $(this.pageCssTo).fadeIn(300);
            }));
            awx.commit();
        }
    },
    
    _pasteClosure$3: function GigShowEdit$_pasteClosure$3(awp, item) {
        /// <param name="awp" type="Await">
        /// </param>
        /// <param name="item" type="WhirliGig.Classes.GigData">
        /// </param>
        awp.addDl(ss.Delegate.create(this, function(aw) {
            this.pasteAw(aw, item);
        }));
    },
    
    pasteAw: function GigShowEdit$pasteAw(awp, item) {
        /// <param name="awp" type="Await">
        /// </param>
        /// <param name="item" type="WhirliGig.Classes.GigData">
        /// </param>
        if ($('#' + item.id).length > 0) {
            item.pos.top += 20;
        }
        item.id = this._reId$3(item.id);
        if (item.parentId != null) {
            item.parentId = this._reId$3(item.parentId);
        }
        if (item.groupId != null) {
            item.groupId = this._reId$3(item.groupId);
        }
        if (item.clusterId != null) {
            item.clusterId = this._reId$3(item.clusterId);
        }
        var gg = this.injectIntoPage(item, new GigEdit(this));
        if (this.get_hasFocus()) {
            this.insert(gg, this.get_focGigEdit());
            var gd = this.get_focusedGd();
            if (gd.actions.paste != null) {
                try {
                    var fn = eval(gd.actions.paste);
                    fn(gg, gd);
                }
                catch (ex) {
                    Inform.error('Failed paste action: {0}', ex);
                }
            }
        }
        awp.done();
    },
    
    _reId$3: function GigShowEdit$_reId$3(id) {
        /// <param name="id" type="String">
        /// </param>
        /// <returns type="String"></returns>
        if (!(id in this._reIds$3)) {
            this._reIds$3[id] = Formulas.get_newId();
        }
        return this._reIds$3[id];
    },
    
    copySlideEv: function GigShowEdit$copySlideEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var items = [];
        var $dict1 = this.get_currentSlide().gigs;
        for (var $key2 in $dict1) {
            var p = { key: $key2, value: $dict1[$key2] };
            items.add(p.value);
        }
        Nsb.Storage.setLocal('CopyBuffer', items);
        new Await().addFn(ss.Delegate.create(this, this.redrawPageGear)).commit();
    },
    
    insert: function GigShowEdit$insert(before, after) {
        /// <param name="before" type="Gig">
        /// </param>
        /// <param name="after" type="Gig">
        /// </param>
        before.element.insertBefore(after.element);
        this._resort$3();
    },
    
    _dragStart$3: function GigShowEdit$_dragStart$3(e, ui) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="ui" type="jQueryUiObject">
        /// </param>
        ThemeYoshi.supressCurateEvents = true;
        this.clearPaint();
        this.get_focGigEdit().maskOff();
        GigShow.gigElBySelect('.GigMe').removeClass('GigMe');
        this.forCluster(e, function(gi) {
            gi.el.addClass('GigMe');
        });
        if (this._group$3.length <= 1) {
            this._group$3.clear();
        }
        var el = $(e.target).closest(Gig.dotGigClassName);
        this._snapToReal$3 = el;
        el = ui.helper;
        if (el.length > 0) {
            this._stX$3 = el.offset().left;
            this._stY$3 = el.offset().top;
            this._snapToEl$3 = el;
            this._snapToW$3 = el.outerWidth();
            this._snapToH$3 = el.outerHeight();
            var tilt = Math.abs(el[0].tilt);
            if (tilt > 0) {
                var ww = this._snapToW$3;
                var hh = this._snapToH$3;
                var tt = el.snapToTilt(tilt);
                this._snapToW$3 = el.snapToTiltW(tt, ww, hh);
                this._snapToH$3 = el.snapToTiltH(tt, ww, hh);
            }
            el.addClass('GigMe');
            this._snapToReal$3.addClass('GigMe');
            el.snapCollect('div.Gig:not(.GigMe), ' + GigShow.pageSelectTo);
            if (this._dragOptions$3['helper'] === 'clone') {
                this._snapToReal$3.hide();
            }
        }
    },
    
    _dragDrag$3: function GigShowEdit$_dragDrag$3(e, ui) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="ui" type="jQueryUiObject">
        /// </param>
        if (this._snapToEl$3.length > 0) {
            var p = this._snapToEl$3.offset();
            if (e.altKey) {
                this._snapToPos$3 = [ p.left, p.top ];
            }
            else {
                this._snapToPos$3 = this._snapToEl$3.snapPos(p.left, p.top, this._snapToW$3, this._snapToH$3);
            }
            if (this._group$3.length > 0) {
                var $enum1 = ss.IEnumerator.getEnumerator(this._group$3);
                while ($enum1.moveNext()) {
                    var gi = $enum1.current;
                    gi.el.css({ top: gi.pos.top + p.top - this._stY$3, left: gi.pos.left + p.left - this._stX$3 });
                }
            }
        }
    },
    
    _dragStop$3: function GigShowEdit$_dragStop$3(e, ui) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        /// <param name="ui" type="jQueryUiObject">
        /// </param>
        ThemeYoshi.supressCurateEvents = false;
        if (this._snapToEl$3.length > 0) {
            this._snapToReal$3.show();
            var p = this._snapToEl$3.offset();
            if (!e.altKey) {
                this._snapToPos$3 = this._snapToEl$3.snapPos(p.left, p.top, this._snapToW$3, this._snapToH$3);
                this._snapToReal$3.offset({ top: this._snapToPos$3[1], left: this._snapToPos$3[0] });
            }
            this._snapToEl$3.snapDump();
            this._snapToEl$3 = this._snapToNone$3;
            if (this._group$3.length > 0) {
                var dx = this._snapToPos$3[0] - this._stX$3;
                var dy = this._snapToPos$3[1] - this._stY$3;
                var $enum1 = ss.IEnumerator.getEnumerator(this._group$3);
                while ($enum1.moveNext()) {
                    var gx = $enum1.current;
                    var gd = gx.gd;
                    gd.pos.top = (gx.pos.top + dy);
                    gd.pos.left = (gx.pos.left + dx);
                    gx.el.css({ top: gd.pos.top, left: gd.pos.left });
                }
                this._group$3.clear();
            }
            if (this._dragOptions$3['helper'] === 'clone') {
                this._snapToEl$3.remove();
            }
        }
        $(document).trigger('DoAfterDrag');
        $(document).bind('AfterDrag2', ss.Delegate.create(this, function() {
            $(document).unbind('AfterDrag2');
            GigShow.gigElBySelect('.GigMe').removeClass('GigMe');
            this.get_focGigEdit().scoopPosition();
            this._reorder$3();
            this.get_focGigEdit().maskOn();
            this.reSlideAndSave(e);
        }));
        $(document).trigger('AfterDrag2');
        $('.' + 'MaskClass', document.body).remove();
    },
    
    imageItem: function WhirliGig_Classes_GigShowEdit$imageItem(url, x, y) {
        /// <param name="url" type="String">
        /// </param>
        /// <param name="x" type="Number" integer="true">
        /// </param>
        /// <param name="y" type="Number" integer="true">
        /// </param>
        if (!url.indexOf(ThemeBase.baseUri)) {
            url = url.substr(ThemeBase.baseUri.length);
        }
        var ge = null;
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        new Await().addDl(function(aw) {
            ImageManager.thumbToFullAw(aw, url);
        }).addDx(function(aw) {
            url = aw.get_result();
        }).addDx(ss.Delegate.create(this, function() {
            gd.html = String.format("<div><img class='GigC' src='{0}'></div>", url);
            gd.classNames = gd.type = 'DropImage';
            gd.dim.width = 200;
            this._insertPos$3(gd, x - 100, y - 100);
        })).addDx(ss.Delegate.create(this, function() {
            ge = this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this, this.saveAllAw)).addDx(function() {
            ge.delayScoopSize(url);
        }).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    textItem: function WhirliGig_Classes_GigShowEdit$textItem(txt) {
        /// <param name="txt" type="String">
        /// </param>
        Inform.event(arguments);
        Exceptions.SaveLog(ThemeBase.eventLogName, 'GigTypes.TextItem()');
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = String.format("<div><div class='GigC'>{0}</div></div>", txt || '-- double-click here to edit --');
        gd.hasHeight = true;
        gd.classNames = gd.type = 'TextItem';
        gd.css = $.extend({}, Gig.deefCss, { 'font-family': 'Calibri', 'font-size': '14pt' });
        gd.dim.width = 270;
        gd.dim.height = 45;
        gd.autosize = true;
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addDx(ss.Delegate.create(this, function() {
            this.editor.autoSize(this.gigById(gd.id));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    htmlOrderedList: function WhirliGig_Classes_GigShowEdit$htmlOrderedList() {
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = String.format("<div><div class='GigC'><h3>Title</h3><ol><li>First line.</li></ol></div></div>");
        gd.hasHeight = true;
        gd.classNames = gd.type = 'TextItem';
        gd.css = { 'font-family': 'Calibri', 'font-size': '16pt' };
        gd.dim.width = 400;
        gd.dim.height = 45;
        gd.autosize = true;
        gd.listType = 'ol';
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    insertButton: function WhirliGig_Classes_GigShowEdit$insertButton() {
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = String.format("<div><button class='GigC'>button</button></div>");
        gd.hasHeight = true;
        gd.classNames = gd.type = 'Button';
        gd.css = { 'font-family': 'Calibri', 'font-size': '16pt' };
        gd.dim.width = 80;
        gd.dim.height = 30;
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    insertTextBox: function WhirliGig_Classes_GigShowEdit$insertTextBox(type) {
        /// <param name="type" type="String">
        /// </param>
        type = type || 'text';
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = String.format("<div><input type='" + type + "' class='GigC'></div>");
        gd.hasHeight = true;
        gd.classNames = gd.type = 'TextBox';
        gd.css = { 'font-family': 'Calibri', 'font-size': '16pt' };
        gd.dim.width = 270;
        gd.dim.height = 45;
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    insertPasswordBox: function WhirliGig_Classes_GigShowEdit$insertPasswordBox() {
        this.insertTextBox('password');
    },
    
    insertTextareaBox: function WhirliGig_Classes_GigShowEdit$insertTextareaBox() {
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = String.format("<div><textarea class='GigC'></textarea></div>");
        gd.hasHeight = true;
        gd.classNames = gd.type = 'TextArea';
        gd.css = { 'font-family': 'Calibri', 'font-size': '16pt' };
        gd.dim.width = 270;
        gd.dim.height = 45;
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    embeddedHtmlCode: function WhirliGig_Classes_GigShowEdit$embeddedHtmlCode(code) {
        /// <param name="code" type="String">
        /// </param>
        var gd = new WhirliGig.Classes.GigData(GigShow.pageSelectTo);
        gd.html = "<div><div class='GigC'>" + code + '</div></div>';
        gd.hasHeight = true;
        gd.classNames = gd.type = 'EmbeddedCode';
        var wh = DomElement.getCodeDim(code);
        gd.dim.width = (wh[0] || 410);
        gd.dim.height = (wh[1] || 342);
        Inform.debug('w={0}, h={1}', gd.dim.width, gd.dim.height);
        this._newPos$3(gd);
        new Await().addDx(ss.Delegate.create(this, function() {
            this.injectIntoPage(gd, new GigEdit(this));
        })).addAw(ss.Delegate.create(this.editor, this.editor.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    askEmbeddedCode: function WhirliGig_Classes_GigShowEdit$askEmbeddedCode() {
        new Await().addAw(ss.Delegate.create(new Ask(), new Ask().textAreaAw), { Msg: 'Enter embedded html code', Value: '' }).addAw(DomElement.requireResultAw, DomElement.notFailOrEmpty).addDx(ss.Delegate.create(this, function(aw) {
            this.embeddedHtmlCode(aw.get_item(PkgBase.resultRx));
        })).commit();
    },
    
    insertLinks: function WhirliGig_Classes_GigShowEdit$insertLinks() {
        var ables = Await.files['insertables'];
        new Await().addDl(ss.Delegate.create(this, function(aw) {
            this.pasteAw(aw, ables['gigs']['Links box']);
        })).addAw(ss.Delegate.create(this, this.saveAllAw)).addDx(ss.Delegate.create(this, function() {
            $(this.pageCssTo).fadeIn(300);
        })).commit();
    },
    
    _newPos$3: function WhirliGig_Classes_GigShowEdit$_newPos$3(gd) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        var el = GigShow.pageSelectToEl;
        var p = el.offset();
        if (el.length > 0) {
            var w = el.innerWidth();
            gd.pos.top = Math.max(0, document.body.scrollTop - p.top) + 5;
            gd.pos.left = (w / 2) - (gd.dim.width / 2);
        }
        else {
            gd.pos.top = 100;
            gd.pos.left = 300;
        }
    },
    
    _insertPos$3: function WhirliGig_Classes_GigShowEdit$_insertPos$3(gd, x, y) {
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <param name="x" type="Number" integer="true">
        /// </param>
        /// <param name="y" type="Number" integer="true">
        /// </param>
        var p = GigShow.pageSelectToEl.offset();
        gd.pos.top = y - p.top;
        gd.pos.left = x - p.left;
    }
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.GroupItem

WhirliGig.Classes.GroupItem = function WhirliGig_Classes_GroupItem() {
    /// <field name="el" type="jQueryObject">
    /// </field>
    /// <field name="gd" type="WhirliGig.Classes.GigData">
    /// </field>
    /// <field name="pos" type="WhirliGig.Classes.Pos">
    /// </field>
    /// <field name="e" type="jQueryEvent">
    /// </field>
}
WhirliGig.Classes.GroupItem.prototype = {
    el: null,
    gd: null,
    pos: null,
    e: null,
    
    fillFromGd: function WhirliGig_Classes_GroupItem$fillFromGd(ev, gd) {
        /// <param name="ev" type="jQueryEvent">
        /// </param>
        /// <param name="gd" type="WhirliGig.Classes.GigData">
        /// </param>
        /// <returns type="WhirliGig.Classes.GroupItem"></returns>
        this.el = GigShow.gigElById(gd.id);
        this.gd = gd;
        this.pos = $.extend({}, gd.pos);
        this.e = ev;
        return this;
    }
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.UndoItem

WhirliGig.Classes.UndoItem = function WhirliGig_Classes_UndoItem(buffer, slide) {
    /// <param name="buffer" type="String">
    /// </param>
    /// <param name="slide" type="Number" integer="true">
    /// </param>
    /// <field name="buffer" type="String">
    /// </field>
    /// <field name="slide" type="Number" integer="true">
    /// </field>
    this.buffer = buffer;
    this.slide = slide;
}
WhirliGig.Classes.UndoItem.parse = function WhirliGig_Classes_UndoItem$parse(content) {
    /// <param name="content" type="String">
    /// </param>
    /// <returns type="Array"></returns>
    try {
        return JSON.parse(content);
    }
    catch ($e1) {
        return null;
    }
}
WhirliGig.Classes.UndoItem.prototype = {
    buffer: null,
    slide: 0
}


////////////////////////////////////////////////////////////////////////////////
// Pages

Pages = function Pages() {
    /// <field name="_outerId$3" type="String" static="true">
    /// </field>
    /// <field name="_optsKey$3" type="String" static="true">
    /// </field>
    /// <field name="_instance$3" type="Pages" static="true">
    /// </field>
    /// <field name="_dragger$3" type="jQueryObject">
    /// </field>
    /// <field name="_opts$3" type="WhirliGig.Classes.PageMgrOpts">
    /// </field>
    /// <field name="_outer$3" type="jQueryObject">
    /// </field>
    /// <field name="_pageList$3" type="jQueryObject">
    /// </field>
    /// <field name="_asking$3" type="Boolean">
    /// </field>
    /// <field name="_pages$3" type="PagesD">
    /// </field>
    /// <field name="_lastDrag$3" type="jQueryObject">
    /// </field>
    /// <field name="_dragging$3" type="String">
    /// </field>
    /// <field name="_dragover$3" type="String">
    /// </field>
    /// <field name="_dragOn$3" type="Boolean">
    /// </field>
    Pages.initializeBase(this);
    Pages._instance$3 = this;
    this._opts$3 = Nsb.Storage.getLocal('PageMgrOpts') || new WhirliGig.Classes.PageMgrOpts();
    Cluster.glass(ss.Delegate.create(this, this._cancelEv$3)).css('background', 'rgba(0,0,0,.55)');
    this._outer$3 = $("<div id='" + 'PageManager' + "' class='AboveHider'/>").appendTo(document.body);
    this._dragger$3 = $("<div class='Dragger'/>").appendTo(this._outer$3);
    this._outer$3.draggable({ stop: ss.Delegate.create(this, this._readSavePos$3), handle: this._dragger$3 });
    this._pageList$3 = $("<div class='pageList'/>").appendTo(this._outer$3);
    var menu = $("<div class='Menu'/>").appendTo(this._outer$3);
    this._createMenu$3(menu);
    $("<button class='cancel'/>").attr('title', ThemeWhirliGig.pageCancelBtnTitle).html('cancel').appendTo(this._outer$3).click(ss.Delegate.create(this, this._cancelEv$3));
    $(document).bind('keydown.Pages', ss.Delegate.create(this, function(e) {
        Keys.escKey(e, ss.Delegate.create(this, this._closeEv$3));
    }));
    Keys.docKeyDown('.Pages', 78, true, ss.Delegate.create(this, this._newPageEv$3));
    Keys.docKeyDown('.Pages', 13, true, ss.Delegate.create(this, this._saveAndCloseEv$3));
    if (!this._opts$3.pos.top) {
        this._outer$3.position({ my: 'top center', at: 'top center', of: window.self, offset: '0 -200', collision: 'fit fit' });
        this._readSavePos$3();
    }
    else {
        this._outer$3.css({ top: this._opts$3.pos.top + document.body.scrollTop, left: this._opts$3.pos.left + document.body.scrollLeft });
    }
    Keys.filterAll(this._outer$3);
    $(document).bind('Asking.Pages', ss.Delegate.create(this, function() {
        this._asking$3 = true;
    }));
    $(document).bind('AskingDone.Pages', ss.Delegate.create(this, function() {
        this._asking$3 = false;
    }));
    DomElement.focusElementAw(Await.get_asyncAw(), this._pageList$3);
}
Pages.Ev = function Pages$Ev(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    DomElement.cancelEvent(e);
    if (Pages._instance$3 != null) {
        return;
    }
    ThemeYoshi.supressCurateEvents = true;
    var pgs = new Pages();
    new Await().addAw(FileBlobBase.retrieveBlobStringAw, ThemeYoshi.pagesPartition, ThemeYoshi.pagesRowKey).handleDl(Exceptions.blobLoadError, Await.abortAw).addDl(function(aw) {
        pgs._pages$3 = JSON.parse(aw.get_result());
        pgs._build$3();
        $("<button class='done DeefBtn'/>").attr('title', ThemeWhirliGig.pageAddDoneTitle).html('done').appendTo(pgs._outer$3).click(ss.Delegate.create(pgs, pgs._saveAndCloseEv$3));
        $("<button class='add'/>").attr('title', ThemeWhirliGig.pageAddBtnTitle).html('+').appendTo(pgs._outer$3).click(ss.Delegate.create(pgs, pgs._newPageEv$3));
    }).commit();
}
Pages.prototype = {
    _dragger$3: null,
    _opts$3: null,
    _outer$3: null,
    _pageList$3: null,
    _asking$3: false,
    _pages$3: null,
    
    _createMenu$3: function Pages$_createMenu$3(menu) {
        /// <param name="menu" type="jQueryObject">
        /// </param>
        $("<div class='Choice'/>").appendTo(menu).html('&#9679; Add images').click(GigShowEdit.uploadImgEv);
        if (ThemeBase.godMode) {
            $('<hr/>').appendTo(menu);
            $("<div class='Choice'/>").appendTo(menu).html('&#9679; Collect images').click(ss.Delegate.create(this, this.collectImagesEv));
        }
    },
    
    _build$3: function Pages$_build$3() {
        var table = $('<table/>').appendTo(this._pageList$3);
        var body = $('<tbody/>').appendTo(table);
        $('<tr/>').appendTo(body).append($("<th class='page'/>").html('page')).append($("<th class='dragger'/>").html('order')).append($("<th class='visible'/>").html('public')).append($("<th class='del'/>").html('del'));
        var $dict1 = this._pages$3.pages;
        for (var $key2 in $dict1) {
            var pg = { key: $key2, value: $dict1[$key2] };
            var row = $('<tr/>').appendTo(body);
            var linkFace = pg.value.Face || pg.value.Name;
            var pageName = pg.value.Name || 'page';
            var isSpecial = pageName === ThemeYoshi.defaultPageName || pageName === ThemeYoshi.adminPageName;
            var lnk = $('<a/>').attr('href', Uri.addPair(Uri.path(window.location.href), 'page', pageName)).html(Transform.htmlize(linkFace)).appendTo(this._pageList$3);
            if (ThemeYoshi.currentPageName === pageName) {
                row.addClass('CurrentPage');
            }
            $("<td class='page'/>").appendTo(row).append(lnk);
            var dragger = $("<td class='dragger Center'/>").appendTo(row);
            if (!isSpecial) {
                dragger.append($("<div style='cursor:pointer;font-size:100%' title='drag to reorder'>" + ThemeBase.dragOrder + '</div>')).click(this._adminClosure$3(pg.value));
            }
            else {
                dragger.append('&nbsp;');
            }
            var visible = $("<input type='checkbox'/>");
            visible.attr({ checked: pg.value.Visible }).click(this._hiderClosure$3(pg.value, visible));
            var shower = $("<td class='showpg'/>").appendTo(row);
            if (!isSpecial) {
                shower.append(visible);
            }
            else if (pageName === ThemeYoshi.defaultPageName) {
                shower.append(String.format("<span style='font-size:120%'>{0}</span>", ThemeBase.ballotBoxChecked));
            }
            else {
                shower.append(String.format("<span style='font-size:120%'>{0}</span>", ThemeBase.ballotBox));
            }
            var td = $("<td class='del Center'/>").appendTo(row);
            if (!isSpecial) {
                td.append($("<div class='del' style='color:rgba(128,0,0,.65);cursor:pointer;' title='delete this page'/>").html('\u2716').mouseenter(Helpers.closureEv(function(e, tdd) {
                    tdd.css('background-color', 'rgba(255,0,0,.25)');
                }, td)).mouseleave(Helpers.closureEv(function(e, tdd) {
                    tdd.css('background-color', '');
                }, td)).click(this._delClosure$3(pg.value)));
                this._addDraggable$3(row, dragger, pg.value.Name, linkFace);
            }
            else {
                td.html('&nbsp;');
            }
        }
    },
    
    _lastDrag$3: null,
    _dragging$3: null,
    _dragover$3: null,
    _dragOn$3: false,
    
    _addDraggable$3: function Pages$_addDraggable$3(row, dragger, name, face) {
        /// <param name="row" type="jQueryObject">
        /// </param>
        /// <param name="dragger" type="jQueryObject">
        /// </param>
        /// <param name="name" type="String">
        /// </param>
        /// <param name="face" type="String">
        /// </param>
        this._dragover$3 = this._dragging$3 = null;
        this._lastDrag$3 = null;
        row.draggable({ handle: dragger, helper: function() {
            return $("<div class='draghelper'/>").html(face);
        }, start: ss.Delegate.create(this, function() {
            this._dragging$3 = name;
        }), stop: ss.Delegate.create(this, this._dropPageEv$3) });
        row.bind('mouseenter', ss.Delegate.create(this, function(e) {
            if (this._dragging$3 != null) {
                this._lastDrag$3 = $(e.target).closest('tr');
                this._lastDrag$3.addClass('DragOver');
                this._dragover$3 = this._lastDrag$3.data('dropkey');
            }
        })).bind('mouseleave', ss.Delegate.create(this, function(e) {
            $(e.target).closest('tr').removeClass('DragOver');
            this._dragover$3 = null;
        })).data('dropkey', name);
    },
    
    _dropPageEv$3: function Pages$_dropPageEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this._dragover$3 == null || this._dragover$3 === ThemeYoshi.defaultPageName || this._dragover$3 === this._dragging$3) {
            if (this._lastDrag$3 != null) {
                this._lastDrag$3.removeClass('DragOver');
            }
            this._dragging$3 = this._dragover$3 = null;
            return;
        }
        Inform.debug('Dropping {0} on {1}', this._dragging$3, this._dragover$3);
        var pages = {};
        var $dict1 = this._pages$3.pages;
        for (var $key2 in $dict1) {
            var pp = { key: $key2, value: $dict1[$key2] };
            if (pp.value.Name === this._dragging$3) {
                continue;
            }
            if (pp.value.Name === this._dragover$3) {
                pages[this._dragging$3] = this._pages$3.pages[this._dragging$3];
            }
            pages[pp.key] = pp.value;
        }
        this._dragging$3 = this._dragover$3 = null;
        this._pages$3.pages = pages;
        ThemeYoshi.pages.pages = pages;
        this._pageList$3.empty();
        this._build$3();
        this._saveAw$3(Await.get_asyncAw());
    },
    
    _readSavePos$3: function Pages$_readSavePos$3() {
        this._opts$3.pos = this._outer$3.offset();
        var p = this._opts$3.pos;
        p.top -= document.body.scrollTop;
        p.left -= document.body.scrollLeft;
        Nsb.Storage.setLocal('PageMgrOpts', this._opts$3);
    },
    
    _hiderClosure$3: function Pages$_hiderClosure$3(pg, el) {
        /// <param name="pg" type="PageD">
        /// </param>
        /// <param name="el" type="jQueryObject">
        /// </param>
        /// <returns type="Function"></returns>
        return ss.Delegate.create(this, function() {
            window.setTimeout(ss.Delegate.create(this, function() {
                pg.Visible = el.is(':checked');
                this._saveAw$3(Await.get_asyncAw());
            }), 1);
        });
    },
    
    _adminClosure$3: function Pages$_adminClosure$3(pg) {
        /// <param name="pg" type="PageD">
        /// </param>
        /// <returns type="Function"></returns>
        return ss.Delegate.create(this, function(e) {
            window.setTimeout(ss.Delegate.create(this, function() {
                if (e.shiftKey) {
                    pg.Admin = !pg.Admin;
                    this._saveAw$3(Await.get_asyncAw());
                }
            }), 1);
        });
    },
    
    _delClosure$3: function Pages$_delClosure$3(pg) {
        /// <param name="pg" type="PageD">
        /// </param>
        /// <returns type="Function"></returns>
        var fnarg = 'Pages.DelClosure';
        return ss.Delegate.create(this, function(e) {
            var awx = new Await();
            if (!e.altKey) {
                awx.addAw(ss.Delegate.create(new Ask(), new Ask().okCancelAw), ThemeYoshi.forSure).addAw(DomElement.requireResultAw, true);
            }
            awx.addDx(ss.Delegate.create(this, function() {
                delete this._pages$3.pages[pg.Name];
                this._pageList$3.empty();
                this._build$3();
                Inform.event(fnarg, pg.Name);
            })).addAw(ss.Delegate.create(this, this._saveAw$3)).addAw(FileBlobBase.emptyFolderAw, Uri.join('pg/gigs', pg.Name || 'aXSAFEXa'), true).commit();
        });
    },
    
    _saveAw$3: function Pages$_saveAw$3(awp) {
        /// <param name="awp" type="Await">
        /// </param>
        Uri.bumpVersion();
        var output = Rx.prettyJson(this._pages$3);
        new Await().addAw(FileBlobBase.storeBlobStringAw, { partitionKey: ThemeYoshi.pagesPartition, rowKey: ThemeYoshi.pagesRowKey, content: output, backup: true }).commit(awp);
    },
    
    _saveAndCloseEv$3: function Pages$_saveAndCloseEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        new Await().addAw(ss.Delegate.create(this, this._saveAw$3)).addDx(ss.Delegate.create(this, function() {
            this._closeEv$3(e);
            ThemeYoshi.reloadPage();
        })).commit();
    },
    
    _newPageEv$3: function Pages$_newPageEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var fnarg = 'Pages.NewPageEv';
        DomElement.cancelEvent(e);
        var newName;
        new Await().addAw(ss.Delegate.create(new Ask(), new Ask().textAw), { Msg: "Title for new page<br><font size='-1'>shown in links and tabs</font>" }).addAw(DomElement.requireResultAw, DomElement.notFailOrEmpty).addDx(ss.Delegate.create(this, function(aw) {
            newName = (aw.get_result()).trim();
            var safeName = Strings.safeFileName(newName);
            var pg = new PageD();
            pg.Name = safeName;
            pg.Face = newName;
            pg.Visible = false;
            this._pages$3.pages[safeName] = pg;
            this._pageList$3.empty();
            this._build$3();
            this._saveAw$3(Await.get_asyncAw());
            Inform.event(fnarg, safeName);
        })).commit();
    },
    
    _cancelEv$3: function Pages$_cancelEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this._closeEv$3(e);
    },
    
    _closeEv$3: function Pages$_closeEv$3(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        if (this._asking$3) {
            return;
        }
        Pages._instance$3 = null;
        ThemeYoshi.supressCurateEvents = false;
        Keys.docKeyReleaseAll('.Pages');
        this._outer$3.remove();
        DomElement.cancelEvent(e);
        Cluster.glassOff(true);
    },
    
    collectImagesEv: function Pages$collectImagesEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        var imgs = $('img');
        var awx = new Await();
        awx.addAw(ImageManager.clearThumbsAw);
        imgs.each(function(i, domEl) {
            var t = $(domEl);
            var src = t.attr('src');
            if (!src.indexOf(ThemeBase.mediaImgUri + '/')) {
                return true;
            }
            awx.addAw(ImageManager.updateImageDataAw, src);
            return true;
        });
        awx.loadAndDo(Uri.scripts('Scripts/PhotoUpload.js'), 'PhotoUploadViewer.UpdateDirImagesEv', { Path: 'pg/images' }, e);
        awx.commit();
    }
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.PageMgrOpts

WhirliGig.Classes.PageMgrOpts = function WhirliGig_Classes_PageMgrOpts() {
    /// <field name="pos" type="WhirliGig.Classes.Pos">
    /// </field>
    this.pos = { Top: 0, Left: 0 };
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.JGigHelpers

WhirliGig.Classes.JGigHelpers = function WhirliGig_Classes_JGigHelpers() {
}
WhirliGig.Classes.JGigHelpers.prp = function WhirliGig_Classes_JGigHelpers$prp(gmp, n, v) {
    /// <param name="gmp" type="Object">
    /// </param>
    /// <param name="n" type="String">
    /// </param>
    /// <param name="v" type="Object">
    /// </param>
    /// <returns type="Object"></returns>
    var d = gmp;
    if (d[n]===false) {
        return null;
    }
    return d[n] || v;
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.GigMu

WhirliGig.Classes.GigMu = function WhirliGig_Classes_GigMu() {
    /// <field name="css" type="Object">
    /// </field>
    /// <field name="glass" type="jQueryObject">
    /// </field>
    /// <field name="host" type="WhirliGig.Classes.IFocusable">
    /// </field>
    /// <field name="markItem" type="System.Action`2">
    /// </field>
    /// <field name="pad" type="jQueryObject">
    /// </field>
    /// <field name="pdm" type="Object">
    /// </field>
    /// <field name="pdp" type="WhirliGig.Classes.GigMuPie">
    /// </field>
    /// <field name="pel" type="jQueryObject">
    /// </field>
    /// <field name="pie" type="jQueryObject">
    /// </field>
    /// <field name="top" type="jQueryObject">
    /// </field>
}
WhirliGig.Classes.GigMu.prototype = {
    css: null,
    glass: null,
    host: null,
    markItem: null,
    pad: null,
    pdm: null,
    pdp: null,
    pel: null,
    pie: null,
    top: null
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGig.Classes.GigMuPie

WhirliGig.Classes.GigMuPie = function WhirliGig_Classes_GigMuPie() {
    /// <field name="align" type="String">
    /// </field>
    /// <field name="brk" type="Boolean">
    /// </field>
    /// <field name="build" type="System.Action`1">
    /// </field>
    /// <field name="css" type="Object">
    /// </field>
    /// <field name="hr" type="Boolean">
    /// </field>
    /// <field name="html" type="String">
    /// </field>
    /// <field name="prop" type="String">
    /// </field>
    /// <field name="set" type="Function">
    /// </field>
    /// <field name="value" type="Object">
    /// </field>
}
WhirliGig.Classes.GigMuPie.prototype = {
    align: null,
    brk: false,
    build: null,
    css: null,
    hr: false,
    html: null,
    prop: null,
    set: null,
    value: null
}


Type.registerNamespace('WhirliGigEdit.Classes');

////////////////////////////////////////////////////////////////////////////////
// Colorizer

Colorizer = function Colorizer(options) {
    /// <param name="options" type="WhirliGigEdit.Classes.ModOptions">
    /// </param>
    /// <field name="colorPickerKey" type="String" static="true">
    /// </field>
    Colorizer.initializeBase(this, [ options ]);
    new Await().loadText('ColorPickerTable', Uri.scripts('Data/GigColorPicker.html')).addDx(ss.Delegate.create(this, function() {
        this.opts.htmlString = this._colorPickerTable$4();
        this.build('Colorizer');
        var opacity = this.opacityEl();
        $('.Body', this.element).click(ss.Delegate.create(this, this.pickEv)).append(opacity);
    })).commit();
}
Colorizer.prototype = {
    
    pickEv: function Colorizer$pickEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.onProp($(e.target).attr('title'));
    },
    
    _colorPickerTable$4: function Colorizer$_colorPickerTable$4() {
        /// <returns type="String"></returns>
        var ot = '';
        ot += "<div class='Gads'>";
        ot += "<span title='none'>x</span>&nbsp;&nbsp;";
        ot += "<span title='transparent'>&#9744;</span>";
        ot += '</div>';
        ot += Await.files['ColorPickerTable'];
        return ot;
    }
}


////////////////////////////////////////////////////////////////////////////////
// GigParse

GigParse = function GigParse() {
    /// <field name="_listToHtmlRx" type="RegExp" static="true">
    /// </field>
}
GigParse.htmlToList = function GigParse$htmlToList(txt, type) {
    /// <param name="txt" type="String">
    /// </param>
    /// <param name="type" type="String">
    /// </param>
    /// <returns type="String"></returns>
    switch (type) {
        case 'ul':
        case 'ol':
            txt = ProcessXml.Process(txt, new WhirliGigEdit.Classes.HtmlToListMap()).output.replace(/(\s*<br>\s*)+$/gi, '');
            break;
    }
    return txt;
}
GigParse.listToHtml = function GigParse$listToHtml(txt, type) {
    /// <param name="txt" type="String">
    /// </param>
    /// <param name="type" type="String">
    /// </param>
    /// <returns type="String"></returns>
    if (type !== 'ol' && type !== 'ul') {
        return txt;
    }
    var idx = GigParse._listToHtmlRx.lastIndex = 0;
    var lvl = 0;
    var ot = '';
    var atFront = true;
    var tx2;
    do {
        tx2 = txt;
        txt = txt.replace(/([\r\n ]*<br>\s*<br>[\r\n ]*)/gi, '<br>');
    } while (tx2 !== txt);
    var mm = GigParse._listToHtmlRx.exec(txt);
    while (mm != null) {
        if (mm[1] != null) {
            var l = mm[1].length;
            if (l > lvl) {
                ot += GigParse._times(l - lvl, '<' + type + '>') + '<li>' + mm[2].trim();
                atFront = false;
            }
            else if (l < lvl) {
                ot += '</li>' + GigParse._times(lvl - l, '</' + type + '>') + '<li>' + mm[2].trim();
                atFront = false;
            }
            else if (mm[2] != null) {
                ot += ((atFront) ? '' : '</li>') + '<li>' + mm[2].trim();
                atFront = false;
            }
            lvl = l;
        }
        if (mm[3] != null) {
            ot += ((atFront) ? '' : '</li>') + '<h3>' + mm[3] + '</h3>';
        }
        if (mm[4] != null) {
            ot += mm[4];
        }
        if (mm[5] != null) {
            ot += ((atFront) ? '' : '</li>') + '<h3>' + mm[5] + '</h3>';
        }
        idx = GigParse._listToHtmlRx.lastIndex;
        mm = GigParse._listToHtmlRx.exec(txt);
    }
    ot += GigParse._times(lvl, '</li></' + type + '>');
    ot = ot.replace(/(\s*<br>\s*)+$/gi, '');
    return ot;
}
GigParse._times = function GigParse$_times(t, txt) {
    /// <param name="t" type="Number" integer="true">
    /// </param>
    /// <param name="txt" type="String">
    /// </param>
    /// <returns type="String"></returns>
    var ot = '';
    while ((t--) > 0) {
        ot += txt;
    }
    return ot;
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGigEdit.Classes.HtmlToListMap

WhirliGigEdit.Classes.HtmlToListMap = function WhirliGigEdit_Classes_HtmlToListMap() {
    /// <field name="_lvl$1" type="Number" integer="true">
    /// </field>
    /// <field name="_consumeTabs$1" type="Boolean">
    /// </field>
    WhirliGigEdit.Classes.HtmlToListMap.initializeBase(this);
    this._lvl$1 = 0;
}
WhirliGigEdit.Classes.HtmlToListMap.prototype = {
    _lvl$1: 0,
    _consumeTabs$1: false,
    
    any: function WhirliGigEdit_Classes_HtmlToListMap$any(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        po.append(this._mTabs$1(po) + po.getFront() + po.getOuter());
    },
    
    area: function WhirliGigEdit_Classes_HtmlToListMap$area(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        po.append(this._mTabs$1(po) + po.getFront().trim());
    },
    
    h3: function WhirliGigEdit_Classes_HtmlToListMap$h3(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        po.append(po.getInner().trim());
    },
    
    span: function WhirliGigEdit_Classes_HtmlToListMap$span(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        if (po.getAttr('style') === 'float:right') {
            po.append(' <right>' + po.getInner().trim());
        }
        else {
            ParseXml.ParseInner(po);
        }
    },
    
    ol: function WhirliGigEdit_Classes_HtmlToListMap$ol(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        this._mLs$1(po);
    },
    
    ul: function WhirliGigEdit_Classes_HtmlToListMap$ul(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        this._mLs$1(po);
    },
    
    li: function WhirliGigEdit_Classes_HtmlToListMap$li(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        this._consumeTabs$1 = true;
        ParseXml.ParseRecur(po);
    },
    
    _mLs$1: function WhirliGigEdit_Classes_HtmlToListMap$_mLs$1(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        var f = po.getFront();
        if (f.length > 0) {
            po.append(this._mTabs$1(po) + f);
        }
        this._lvl$1++;
        ParseXml.ParseRecur(po);
        this._lvl$1--;
    },
    
    _mTabs$1: function WhirliGigEdit_Classes_HtmlToListMap$_mTabs$1(po) {
        /// <param name="po" type="ParseXml">
        /// </param>
        /// <returns type="String"></returns>
        var ot = '';
        if (this._consumeTabs$1) {
            ot = ((po.buffer().substr(po.buffer().length - 4) === '<br>') ? '' : '<br>') + '\t\t\t\t\t\t\t\t\t\t'.substr(0, this._lvl$1);
        }
        this._consumeTabs$1 = false;
        return ot;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Modifier

Modifier = function Modifier(options) {
    /// <param name="options" type="WhirliGigEdit.Classes.ModOptions">
    /// </param>
    /// <field name="opts" type="WhirliGigEdit.Classes.ModOptions">
    /// </field>
    /// <field name="_opacity$3" type="jQueryObject">
    /// </field>
    Modifier.initializeBase(this);
    this.opts = options;
    this.opts.isColor = this.opts.prop != null && this.opts.prop.indexOf('color') !== -1;
}
Modifier.prototype = {
    opts: null,
    _opacity$3: null,
    
    build: function Modifier$build(classNames) {
        /// <param name="classNames" type="String">
        /// </param>
        Cluster.glass(ss.Delegate.create(this, this.closeEv));
        this.element = $("<div class='Modifier'/>").addClass('AboveHider');
        if (classNames != null) {
            this.element.addClass(classNames);
        }
        var title = $("<div class='Title'/>").appendTo(this.element).html(this.opts.title);
        if (this.opts.html != null) {
            this.element.append(this.opts.html.addClass('Body'));
        }
        else if (this.opts.htmlString != null) {
            $("<div class='Body'/>").appendTo(this.element).html(this.opts.htmlString);
        }
        if (this.opts.css != null) {
            this.element.css(this.opts.css);
        }
        $(document.body).append(this.element);
        this.element.draggable({ handle: title });
        this.element.position({ my: 'center', at: 'center', of: $(window) });
    },
    
    onChange: function Modifier$onChange(v) {
        /// <param name="v" type="Object">
        /// </param>
        if (this.opts.onChange != null) {
            this.opts.onChange(this.opts, this.mixColor(v));
        }
    },
    
    onSave: function Modifier$onSave() {
        if (this.opts.onSave != null) {
            this.opts.onSave(this.opts);
        }
    },
    
    closeEv: function Modifier$closeEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.element.remove();
    },
    
    onProp: function Modifier$onProp(v) {
        /// <param name="v" type="Object">
        /// </param>
        if (v != null) {
            this.onChange(v);
            this.onSave();
        }
    },
    
    mixColor: function Modifier$mixColor(v) {
        /// <param name="v" type="Object">
        /// </param>
        /// <returns type="Object"></returns>
        if (this.opts.isColor) {
            var cc = v;
            if (cc === 'transparent') {
                this.setOpacity(0);
                return cc;
            }
            if (cc === 'none') {
                this.setOpacity(1);
                return '';
            }
            if (this._opacity$3 != null) {
                var cx = Css.getColor(cc);
                cx.opacity = parseFloat(this._opacity$3.val());
                if (!cx.opacity) {
                    cx.opacity = 1;
                    this.setOpacity(1);
                }
                return cx.toString();
            }
        }
        return v;
    },
    
    opacityEv: function Modifier$opacityEv(e) {
        /// <param name="e" type="jQueryEvent">
        /// </param>
        this.onProp(this.opts.toStore[this.opts.prop]);
    },
    
    setOpacity: function Modifier$setOpacity(v) {
        /// <param name="v" type="Number">
        /// </param>
        if (this._opacity$3 != null) {
            this._opacity$3.val((Math.round(v * 100) / 100).toString());
        }
    },
    
    opacityEl: function Modifier$opacityEl() {
        /// <returns type="jQueryObject"></returns>
        this._opacity$3 = $("<select class='SelOpacity'/>");
        for (var i = 0; i <= 100; i++) {
            $('<option/>').attr('value', (i / 100).toString()).html(i + '%').appendTo(this._opacity$3);
        }
        if (this.opts.prop != null && this.opts.toStore != null) {
            var cx = Css.getColor(this.opts.toStore[this.opts.prop]);
            this.setOpacity(cx.opacity);
        }
        this._opacity$3.change(ss.Delegate.create(this, this.opacityEv));
        return this._opacity$3;
    }
}


////////////////////////////////////////////////////////////////////////////////
// WhirliGigEdit.Classes.ModOptions

WhirliGigEdit.Classes.ModOptions = function WhirliGigEdit_Classes_ModOptions() {
    /// <field name="title" type="String">
    /// </field>
    /// <field name="prop" type="String">
    /// </field>
    /// <field name="isColor" type="Boolean">
    /// </field>
    /// <field name="isPgBackground" type="Boolean">
    /// </field>
    /// <field name="html" type="jQueryObject">
    /// </field>
    /// <field name="htmlString" type="String">
    /// </field>
    /// <field name="toChange" type="jQueryObject">
    /// </field>
    /// <field name="toStore" type="Object">
    /// </field>
    /// <field name="onCancel" type="Function">
    /// </field>
    /// <field name="onSave" type="System.Action`1">
    /// </field>
    /// <field name="onChange" type="System.Action`2">
    /// </field>
    /// <field name="css" type="Object">
    /// </field>
}
WhirliGigEdit.Classes.ModOptions.prototype = {
    title: null,
    prop: null,
    isColor: false,
    isPgBackground: false,
    html: null,
    htmlString: null,
    toChange: null,
    toStore: null,
    onCancel: null,
    onSave: null,
    onChange: null,
    css: null
}


////////////////////////////////////////////////////////////////////////////////
// Publish

Publish = function Publish() {
    /// <field name="_pgTop$3" type="String" static="true">
    /// </field>
    /// <field name="_pgEnd$3" type="String" static="true">
    /// </field>
    /// <field name="publishedIndex" type="String" static="true">
    /// </field>
    Publish.initializeBase(this);
}
Publish.PublishThisPageEv = function Publish$PublishThisPageEv(e) {
    /// <param name="e" type="jQueryEvent">
    /// </param>
    DomElement.cancelEvent(e);
    if (ThemeYoshi.currentPageName === ThemeYoshi.adminPageName) {
        Cluster.glassOff();
        Cluster.flashWindow();
        return;
    }
    var awx = new Await();
    if (!ThemeYoshi.get_currentPage().Visible) {
        awx.addAw(ss.Delegate.create(new Ask(), new Ask().okCancelAw), { Msg: String.format('<small>This is a hidden page. If you publish it, then anyone will be able to view it at<br>{0}{1}</small>', ThemeYoshi.baseUrl(), ThemeYoshi.publishedUrl()) }).addAw(DomElement.requireResultAw, true);
    }
    awx.addDx(function() {
        Nsb.Storage.setLocal(ThemeYoshi.publishingKey, true);
        Nsb.Storage.setLocal(ThemeYoshi.get_curatingKey(), false);
        Nsb.Storage.setLocal(ThemeYoshi.get_metaBarKey(), false);
        ThemeBase.pageAction(function() {
            GigShow.PublishThisPagePx();
        });
        Uri.bumpVersion();
        ThemeYoshi.reloadPage();
    }).commit();
}
Publish.PublishThisPage = function Publish$PublishThisPage() {
    new Await().addAw(Publish.PublishThisPageAw).addDx(function() {
        ThemeBase.publishing = false;
        Nsb.Storage.removeLocal(ThemeYoshi.publishingKey);
        Nsb.Storage.setLocal(ThemeYoshi.get_curatingKey(), true);
        ThemeBase.pageAction(function() {
            Ask.ok('current page is published');
        });
        ThemeYoshi.reloadPage();
    }).commit();
}
Publish.PublishEv = function Publish$PublishEv(e) {
    /// <summary>
    /// Publish all the publishable pages
    /// </summary>
    /// <param name="e" type="jQueryEvent">
    /// event
    /// </param>
    DomElement.cancelEvent(e);
    Nsb.Storage.setSession('PublishTime', new Date().getTime());
    Nsb.Storage.setLocal(ThemeYoshi.publishingKey, true);
    Nsb.Storage.setLocal(ThemeYoshi.get_curatingKey(), false);
    Nsb.Storage.setLocal(ThemeYoshi.get_metaBarKey(), false);
    ThemeBase.pageAction(function() {
        GigShow.PublishPagePx(-1);
    });
    Uri.bumpVersion();
    new Await().addAw(Publish._deletePublishedFilesAw$3).addAw(Publish._snapshotSoftwareAw$3).addFn(ThemeYoshi.reloadPage).commit();
}
Publish.PublishPage = function Publish$PublishPage(nxt) {
    /// <param name="nxt" type="Number" integer="true">
    /// </param>
    var idx = 0;
    var awx = new Await();
    var $dict1 = ThemeYoshi.pages.pages;
    for (var $key2 in $dict1) {
        var pg = { key: $key2, value: $dict1[$key2] };
        if (idx === nxt) {
            if (pg.value.Visible) {
                Inform.debug('Adding page idx={0}', idx);
                awx.addAw(Publish.PublishThisPageAw);
            }
            else {
                nxt++;
            }
        }
        else if (idx === nxt + 1) {
            if (pg.value.Visible) {
                Inform.debug('Queing page idx={0}', idx);
                awx.addDx(function() {
                    Nsb.Storage.setSession(ThemeBase.pageActionKey, String.format('GigShow.PublishPagePx({0});', idx));
                });
                awx.addDx(function() {
                    Master.GoPage(ThemeYoshi.currentPageClass, pg.value.Name);
                });
                awx.commit();
                return;
            }
            nxt++;
        }
        Inform.debug('Skipping page idx={0}', idx);
        idx++;
    }
    awx.addDx(function() {
        ThemeBase.publishing = false;
        Nsb.Storage.removeLocal(ThemeYoshi.publishingKey);
        ThemeBase.pageAction(function() {
            Nsb.Storage.setLocal(ThemeYoshi.get_curatingKey(), true);
            ThemeBase.pageAction(function() {
                Ask.ok('publish complete');
            });
            ThemeYoshi.reloadPage();
        });
        Master.GoPage(ThemeYoshi.defaultPageClass, ThemeYoshi.adminPageName);
    });
    awx.commit();
}
Publish._rewriteLink$3 = function Publish$_rewriteLink$3(href, el) {
    /// <param name="href" type="String">
    /// </param>
    /// <param name="el" type="jQueryObject">
    /// </param>
    /// <returns type="String"></returns>
    if (href === 'javascript:;') {
        href = Strings.safeFileName(el.html()) + '.html';
        return href;
    }
    if (!href.indexOf(ThemeYoshi.masterPage)) {
        href = (Uri.getValue(href, 'page') || ThemeYoshi.defaultPageName) + '.html';
        el.removeAttr('target');
        return href;
    }
    return href;
}
Publish.PublishThisPageAw = function Publish$PublishThisPageAw(awp) {
    /// <param name="awp" type="Await">
    /// </param>
    var fnarg = 'Publish.PublishThisPageAw';
    var pg = '\ufeff';
    var links = $('a');
    links.each(function(i, domEl) {
        var t = $(domEl);
        t.attr('href', Publish._rewriteLink$3(t.attr('href'), t));
    });
    var ct = $('html').html().trim();
    ct = ct.replace(/\d+XvXvXv/, Uri.get_masterVersion() + 'XvXvXv');
    ct = ct.replace(/<[s]cript\s+src=".*\/master.js\?_=\d+"\s*><\/[s]cript>/, '');
    ct = ct.replace(/<[l]ink\s+rel="Stylesheet"\s+type="text\/css"\s+href=".*\/master.css\?_=.+"\s*\/?>/, '');
    ct = ct.substr(0, ct.length - '</body>'.length);
    ct += '\r\n<' + "script type='text/javascript'> jQuery('#PageGigs').hide();<" + '/script>';
    ct += '\r\n<' + "script type='text/javascript'> setTimeout( function() { try { StaticBuild.BuildAction('" + (ThemeYoshi.currentBuildAction || '') + "', '" + (ThemeYoshi.currentLoadLibs || '') + "', '" + (ThemeYoshi.currentLoadCss || '') + "'); } catch (ex) {}; }, 1 );<" + '/script>';
    var tilts = GigShow.getTilts();
    if (Object.getKeyCount(tilts) > 0) {
        ct += '\r\n<' + "script type='text/javascript'> setTimeout( function() { try { StaticBuild.Tilt(" + JSON.stringify(tilts) + '); } catch (ex) {} }, 1 );<' + '/script>';
    }
    ct += '\r\n<' + "script type='text/javascript'> setTimeout( function() { try { StaticBuild.Finish(); } catch (ex) {} }, 1 );<" + '/script>';
    ct += '\r\n</body>';
    pg += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">';
    pg += ct;
    pg += '</html>';
    var pm = new StoreParams();
    pm.partitionKey = '../pages';
    pm.rowKey = ThemeYoshi.currentPageName + '.html';
    pm.content = pg;
    var awx = new Await().addAw(FileBlobBase.storeBlobStringAw, pm).addDx(function() {
        Inform.event(fnarg, pm.rowKey);
    });
    if (ThemeYoshi.currentPageName === ThemeYoshi.defaultPageName) {
        awx.addDx(function() {
            pm.content = Publish.publishedIndex.replaceAll('@pagename@', Uri.join('pages', ThemeYoshi.defaultPageName + '.html'));
            pm.partitionKey = '../';
            pm.rowKey = 'index.html';
        }).addAw(FileBlobBase.storeBlobStringAw, pm).addDx(function() {
            Inform.event(fnarg, pm.rowKey);
        });
    }
    awx.commit(awp);
}
Publish._deletePublishedFilesAw$3 = function Publish$_deletePublishedFilesAw$3(awp) {
    /// <param name="awp" type="Await">
    /// </param>
    new Await().addAw(FileBlobBase.emptyFolderAw, '../pages').handleDl(Exceptions.blobLoadError, Await.ignoreAw).commit(awp);
}
Publish._snapshotSoftwareAw$3 = function Publish$_snapshotSoftwareAw$3(awp) {
    /// <param name="awp" type="Await">
    /// </param>
    var url = Uri.addPair(Uri.app('publish.php'), 'password', Nsb.Storage.getLocal(ThemeYoshi.get_curatePasswordKey()));
    new Await().loadJson('snapshot', url).handleDl(Exceptions.blobLoadError, Await.ignoreAw).commit(awp);
}


ChompWindow.registerClass('ChompWindow', Actor);
EditCss.registerClass('EditCss', Ask);
EditRawGigs.registerClass('EditRawGigs', Actor);
GigEdit.registerClass('GigEdit', Gig, WhirliGig.Classes.IFocusable);
GigShowEdit.registerClass('GigShowEdit', GigShow, IGigShowEdit);
WhirliGig.Classes.GroupItem.registerClass('WhirliGig.Classes.GroupItem');
WhirliGig.Classes.UndoItem.registerClass('WhirliGig.Classes.UndoItem');
Pages.registerClass('Pages', Actor);
WhirliGig.Classes.PageMgrOpts.registerClass('WhirliGig.Classes.PageMgrOpts');
WhirliGig.Classes.JGigHelpers.registerClass('WhirliGig.Classes.JGigHelpers');
WhirliGig.Classes.GigMu.registerClass('WhirliGig.Classes.GigMu');
WhirliGig.Classes.GigMuPie.registerClass('WhirliGig.Classes.GigMuPie');
Modifier.registerClass('Modifier', Actor);
Colorizer.registerClass('Colorizer', Modifier);
GigParse.registerClass('GigParse');
WhirliGigEdit.Classes.HtmlToListMap.registerClass('WhirliGigEdit.Classes.HtmlToListMap', Parse.Classes.XmlMap);
WhirliGigEdit.Classes.ModOptions.registerClass('WhirliGigEdit.Classes.ModOptions');
Publish.registerClass('Publish', Actor);
GigEdit.yourText = '-- double-click here to edit --';
GigEdit.embeddedCodeType = 'EmbeddedCode';
GigEdit.coverBloatClass = 'CoverBloat';
GigEdit._dotMaskOnClass$4 = '.' + 'MaskOn';
GigEdit._gigTypes$4 = { ClassItem: { menus: [ 'colors:both', 'border', 'font', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] }, TextItem: { menus: [ 'colors:both', 'border', 'font', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'link', 'zero', 'remove', 'cancel' ] }, Button: { menus: [ 'colors:both', 'border', 'font', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] }, TextBox: { menus: [ 'colors:both', 'border', 'font', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] }, TextArea: { menus: [ 'colors:both', 'border', 'font', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] }, DropImage: { menus: [ 'color:bg', 'border', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'link', 'zero', 'remove', 'cancel' ] }, GoogleSlideShow: { menus: [ 'border', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] }, EmbeddedCode: { menus: [ 'border', 'layer', 'copy', 'groupify:<u>g</u>roupify', 'zero', 'remove', 'cancel' ] } };
GigEdit._gmu$4 = null;
GigShowEdit.gseInstance = null;
GigShowEdit.afterDragName = 'DoAfterDrag';
GigShowEdit.maskClassName = 'MaskClass';
Pages._instance$3 = null;
Colorizer.colorPickerKey = 'ColorPickerTable';
GigParse._listToHtmlRx = /(\t+)(.+?)(?:<br>|$)|(.*?)(<span style="float:right">.+?<\/span>(?:<br>|$))|(.+?)(?:<br>|$)/gi;
Publish.publishedIndex = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + '<html xmlns="http://www.w3.org/1999/xhtml">' + '<head>' + '<title>website</title>' + '<meta http-equiv="refresh" content="0;url=@pagename@">' + '</head>' + '<body>' + '<' + 'script type="text/javascript">' + 'window.location.href = "@pagename@";' + '<' + '/script>' + '</body>' + '</html>';
})();

//! This script was generated using Script# v0.7.4.0
